Saturday 1 September 2012

Refining the third person camera

As per the group's requests, I've started modifying the third person camera in the Knightside Chronicles demo to allow direct control of the camera by the user via the right analog stick on the Xbox 360 controller.

Now, when the player moves the right analog stick, they will be able to assume direct control of the camera and manually rotate around the player and also tilt up to better see what's at the player character's feet or on the ground.

How it works:

By reworking some of the code from the mouseLook script included in the standard assets package with unity, I added a few additional lines of code to the camera controller script which moves and rotates the camera object when the game detects input from the x and/or y axis from the right analog stick.
A set of if statements is then also added so that the script will only move the camera using the input from the analog stick when the game detects input from the right analog and it is not in the neutral centre position. Otherwise, it will continue to move the camera automatically as the player character moves and rotates, as it would usually.


No comments:

Post a Comment

Note: only a member of this blog may post a comment.