27. May 2010 19:59
One very important aspect of a RTS game is that you need to be able to see your units, which means there needs to be a camera. Preferably one that the player can move around and look at the map and generally see what's going on where. I started working on camera controls to allow the user to see things.
The game that inspired me the most for camera controls has been Warhammer 40k: Dawn of War II. This game allows for full 360 degree rotation on the vertical axis, zooming in and out, and cardinal direction movement. Since we are also making a similar type of game (except with giant reptiles and Moorish castles), I thought this would be a good starting point for ideas.
I started modifying a camera in a Unity demo project and researching on how to detect input methods. Turns out, detecting input was my greatest hurdle for the project due to lack of documentation, but it's way easy. It wasn't very long before I had a camera moving around with the arrow keys and zooming in and out with a scroll wheel. Next step was getting the camera to move by moving the cursor next to an edge of a screen, which didn't take long either.
I thought about some more features that would be neat for the camera, such as accelerating the movement speed of the camera either by holding down an arrow key for an extended period of time or moving the cursor closer to the edge of the screen. Those would allow for finer control of the camera and faster movement across the map. I managed to get the camera to move faster or slower based on how close the cursor is to the edge of the screen but I do not have acceleration working for arrow keys.
I also got camera rotation "working". By "working" I mean I can rotate the camera by holding down an "Alt" key and moving the mouse left or right. But then when you try to move forward with the camera it moves the direction of the original "North". Not good so I'm currently working on that. I have a few ideas on how to solve the problem but I'm hoping I get to trigonometry. Everywhere. Probably not though since Unity makes everything so easy :-/.
d259cdb0-8a8d-4f61-9d7c-06bff79df598|0|.0
By: JasonDees
Category:
Tags: camera