The Brief

For this task I was required to make a switch and door mechanism, along with a third person camera to follow the player character. I should produce a system that allows the follow camera to transition from following the player to a cutscene during the door animation. Some extra things I aim to achieve to make a more polished system are as follows:

  • Multiple cutscenes including different doors and switches to demonstrate a robust system.
  • Prevent the camera clipping into meshes in the environment.
  • Snap the follow camera to the NESW axis when camera input is idle.
  • Add camera shake when necessary to make it feel as if it’s part of the world.
  • Add particle systems on impact to add polish and juice to the environment.


A screen capture of Zelda gameplay showing the switch mechanism cutscene.

Implementing switches and doors.

I used the following equation to interpolate the follow camera’s position towards any given position in the world.

y = 1 / (1 + e^(-12(x - 0.5))), where x = (1 - (camera destination - camera start position)) / (camera destination - camera current position)

This created a smooth transition, with the movement speed starting and ending steadily but increasing rapidly throughout the middle of the transition. This method made for a much more polished feel during the cutscenes than a simple linear transition. It meant I could proudly compare my camera work to top games that use similar methods, such as the Legend of Zelda. A graph of the equation can be seen below, to help visualise the transition.


I created simple animations using Unity’s animation timeline for the switch and the door. Adding camera shake and a particle system that is instaniated from the switch during impact, creating a more polished system.

The clip below demonstrates the final result of this implementation.


Creating a controllable follow camera.

The follow camera can be rotated around a focal point along the x-axis, in this case the focal point is the player character. It takes input from the horizontal position of the right anolog stick on the gamepad. The position of the camera along the y-axis can be set to three different values, this value is updated each time the right along stick on the gamepad is pressed inwards. This allows the player to widen but also lessen their field of view when playing the game.

A system used in many 3D third person games, is one that locks the camera to the NSEW axes in a smooth way. I have acheived this by getting the closest axis to the current position and then interpolating towards that axis. This method is only called when the player is idle.

The final feature of the my follow camera is a system that prevents it from clipping into meshes within the environment. This is a system used in almost all 3D games as means the player’s view is never restricted. I created a system that casts a ray from the focal point to the camera, if there is a mesh detected between these two objects then the camera is force to interpolate towards the position of the focal point, thus never clipping inside of it. The clip below demonstrates this system.


Check out my progress so far.