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 *

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