Player Camera


Introduction

This week I decided to work on the player camera. My thoughts were to have the camera only rotate when the middle-mouse button is held down and have a minimum and maximum pitch, or height angle. The camera is also supposed to follow the player character at all times.

My initial research led me to this thread which worked great, however I was unable to figure out how to use a min/max clamp on the camera's pitch. After some more research, I came across this YouTube video that includes a min/max clamp for the camera's pitch. I added an if statement to make the camera rotate only if the middle-mouse button is being pressed down.

The camera will look at, or target, the active player; this allows for the possible implementation of multiple party members and the focusing the camera on the selected party member. The camera sensitivity can also be adjusted.

Resources

Third Person camera, how to rotate around character?

Unity 5 Third Person Camera [Tutorial][C#] - Unity 3D

Solution Justification

I chose to program the camera in this manner to stay consistent with the camera controls of Dungeon Siege. Also, to allow for future implementations, such as focusing on other party members.

EDIT: Removed an unnecessary if statement.

Comments

Log in with itch.io to leave a comment.

Well done Ruan, keep up the great work!