BGP Week 1 – Camera Angles
|
It seems proper to start with an introduction. This blog post, and the ones that will follow it are on the subject of the Big Game Project course at Uppsala University Campus Gotland where I, as part of a group of six people, will be working on developing a game. The game I will be working on has started out with the project name Spacegoo Adventures, and is a 3D puzzle platformer. The first week I started out working on getting the camera to work. Using the Super Character Controller module we already had basic movement with the camera following the player, so all that was needed was the ability to steer the direction of the camera. To do this all that was needed was an input for Quaternions, Unity’s main way to calculate rotation, using the controller input, the camera’s current angle, and a preset speed value. By using Quaternion.AngleAxis with the input of the set value and a Vector holding the controller input, times the the current angle. Next was locking the vertical rotation so that the camera could not end up up-side down. This ended up taking longer than expected due to me originally placing an extra variable in the Quaternion.AngleAxis. By moving this variable outside the AngleAxis, I could use the Unity function Mathf.Clamp to define the limits of the camera and lock it to them. The final result was a simple but working camera that will need improvements later, but was good enough to work for initial testing, allowing our designer to proceed ahead with testing the game and starting to design levels. |