3D Real-Time-Strategy (RTS) Game Tutorial – Part 2

3D Real-Time-Strategy (RTS) Game Tutorial – Part 2 (C#)


Part 1

We started to create and place buildings in Part 1. In this part, we will move our camera with mouse. As you know, usually camera moves when the cursor touches to edge of screen. Also, holding right mouse button down provides camera movement when you drag the mouse. Both of them are popular movements.

Firstly, lets move the camera with mouse button and drag. We need a float speed variable and x&y positions of the mouse.

Create a new C# script and attach it to the camera.

When you hold right mouse button down and drag it, camera moves. You don’t need to do this for “Mouse Y”, it works.

The other solution is to drag the cursor to the edges of screen. We need speed, boundary, width and height.

Use whichever you want, both of them are so cool.

©Coffee Break Codes – 3D Real-Time-Strategy (RTS) Game Tutorial – Unity3D

Leave a comment

Your email address will not be published. Required fields are marked *

7 thoughts on “3D Real-Time-Strategy (RTS) Game Tutorial – Part 2

  • gamefly

    After looking into a number of the articles on your web site,
    I seriously like your technique of writing a blog. I book-marked
    it to my bookmark site list and will be checking back in the near future.
    Take a look at my web site too and tell me your opinion.

  • gamefly

    I think this is among the most important info for me.
    And i am glad reading your article. But wanna remark
    on few general things, The web site style is wonderful,
    the articles is really nice : D. Good job, cheers

  • gamefly

    I know this if off topic but I’m looking into starting my own weblog and
    was wondering what all is required to get set up? I’m assuming having
    a blog like yours would cost a pretty penny? I’m not very internet savvy so I’m not 100% certain. Any suggestions or advice would
    be greatly appreciated. Thank you