Coding skills: Part 3
- neelvinay17
- Aug 27, 2023
- 1 min read
Once I had finished with the player locomotion, I needed to get my player camera set up. What I wanted it to be was a 3rd person camera, which would follow the player wherever he went. However, something lots of games do is that wherever the camera looks is the player's forward. I wanted the forward to always be constant, so that a side and front view of the character would also be plausible. To be able to do this, I needed a cameraHandler script. In the script, I created a few variables for what the target transform would be, what the camera transform would be and the camera pivot transform. Essentially, the camera needed 3 major things for it to work: what it would follow, what camera it was using to follow the target, and around what object the camera was pivoted for rotation. I then also added a few more variables for lookspeed, rotation speed, the pivot angle and the minimum and maximum pivot. Writing every single step with far too much detail here would be impossible, so the major aspect which I covered next was how I used lerp to get the camera follow. It is very complicated to explain here, so I will put a snippet of the code, and if there are any questions, I am always available to answer.
_______________________________________________________________________________________________________





Comments