Aiming a Gun in 3rd person

To aim a gun, we need to use cinemachine to go to a OTS view. We also need to use layer masks. Start by creating a new virtual camera and place it in the ots perspective.

We want the transition to go faster so either change the entire cinemachine speed or add a blend for the cinemachine state.

Next, create a bool for when we aim down the camera as a parameter in the camera.

In our input manager, let’s add the aim button.

In our starter assets input, let’s add the ability to capture the input of the right mouse button being held down.

In our first person controller, let’s go ahead and send a function to our Aim in our custom controller to begin aiming.

In our custom controls, I want to set the animation aim state to true and switch cameras when we press the right mouse button.

For our animator, let’s connect the aim to the idle blendtree.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Al Heck

Unity Developer and Software Engineer who loves making games with GameDevHQ