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.

--

--

--

Unity Developer and Software Engineer who loves making games with GameDevHQ

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

2019 CLI Project

How to Write Bug-Free Goroutines in Go (Golang)

Gopher in a fire

Different Ways to Get Time Intervals (C++)

Details about well- http://ift.tt/2jhb9xb

At the beginning of each project, the first question I always aim to answer is, “Where is my data…

API Extra Security Layer for Mobile Use with Package Restriction using Laravel

A New Chapter Begins 🌱🌳

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

Al Heck

Unity Developer and Software Engineer who loves making games with GameDevHQ

More from Medium

Aim the pistol up and down using blend trees

Who is Mike Wolcott?

Mike Wolcott is pictured here

Break Out of Tutorial Loops

Unity Projectiles