Over-The-Shoulder Aiming in Unity

Heathrileyo
2 min readMay 31, 2022

--

Good morning! I hope everyone had a pleasant weekend. Today we’re going to combine some of the things we’ve learned into a proper exercise. By using animations and an animation state camera not only will we be able to give our player a camera zoom over the shoulder as if they were aiming, but we’ll also be adding an animation to the player’s character to really put it in perspective.

Just like anything there has to be a start. Let’s make our player, our player’s aiming animation and a way to switch between the two.

Standing Still
Aiming

And here is where we’ll add a bool to check if the aiming is true.

Don’t forget to remove the exit time, or else you might find your player takes too long to aim.

Simply uncheck the box named “Has Exit Time”.

Now that we have our states, let’s make a state based Cinemachine camera. Of course you have to drag your animated object into the inspector of the camera. Then we can set our states in it!

Now we have a fully functional player! Each camera has a different use and really makes things come to life for your game. Let’s watch our player aim camera change and animation now to see if it worked.

Excellent! You’ve put together two very important lessons into a single experience for your player. You can easily approach many different aspects of your game like this. See you again soon!

--

--

Heathrileyo

Full time father of two attempts to fill your prescription and become proficient in the world of game dev