Forcing camera to be behind character and looking at forward direction

I have the following Camera:

What this camera should do is be behind the player and then when activated give him the ability to look left, right, up and down in forward direction.

Then i have 2 other cameras that my system blends between

Free run camera

For when the camera runs around. This camera allows you to look around the player and run in that direction.

Now something funny happens when i turn my character 180 degrees. When i do that and change to the this aim camera i get the following result:

The camera looks at the at the players front instead of staying behind the player.

Is there any way i can force this camera to always be behind the player no matter what?

Enable Horizontal Recentering on POV. Does it rotate the vcam to the correct position?

Hey thanks for your reply sadly this didn’t work. And i think that by enabling this i will force the player not to be able to aim with the camera since it will force him in that direction :frowning:

Yes, you should not enable it for the game. I just wanted to check if it rotates to the correct position. If it is not rotating the vcam to the correct position, then your player’s forward is not defined properly.

Otherwise, if you want a third person vcam that depends on the follow target’s orientation and not on input, then I’d suggest you to look at the AimingRig example. This example uses the 3rdPersonFollow component.

You need Cinemachine 2.6 or newer to see this example in our samples. You can get the samples from the Package Manager.

You may also look at this tutorial video explaining how to get and add extra features to our sample scene:

1 Like

Thank you for your response. But the github project that they say are in the description doesn’t point to the code they show in the video do you have the correct link by any chance?

I’ll try to find it. In the meantime, you can look at our AimingRig example in our samples. Get it from Package Manager, see the attached image.

6361995--708006--Screen Shot 2020-09-29 at 9.57.35 AM.png

Ive tried that example but if you look at it the aim doesn’t actually follow the target. The video sent me seems to be the “correct” way of doing things so i am really really interested in the code :smile:

What do you mean by that? That example uses the same setup as they are using in the video linked above.
It uses 3rdPersonFollow and 3rdPersonAim.

The video uses a script to control the rotation only when its aimed. The example uses a aim POV :slight_smile:

I see now :slight_smile: Sent you the scripts

If you set to “Lock to target with world up” it, then it will lock behind. Or have a look at the ThirdPersonFollow component and examples mentioned above.

If Simple follow works perfectly otherwise, then yes, just make sure the vcam starts from behind the player.