Setting direction for Freelook camera.

What if you wanted to set a specific vector for the freelook camera to orient to as forward? How is this accomplished? It doesn’t need to happen all the time but I’d like to be able to tell it where to look exactly and move it there during a lerp from wherever it was before.

You would think it should be as easy as telling cinemachine to take the direction from the camera, but it doesn’t seem to be. I’ve been having trouble getting it to behave too. Related discussion here.

It seems the OP of that post found a work around, but I haven’t yet figured out what it is. I posted my code for teleporting my camera but as soon as I turn the VCam back on it screws up the lok direction, even though the look at target is in the exact same position relative to old look at target.

Hmmm… this is a little tricky. It’s a question of finding the right values to put into the X and Y axes of the freelook, which will depend on the orbits and the binding mode.

Currently there is a private API to do something like this, which is called from OnTransitionFromCamera() when InheritPosition is enabled. We could look into making a public API for this feature.

You mentioned lerp. Does that mean that you’re transitioning from another vcam and want the incoming freelook to have axis values to best match its position? In that case, InheritPosition should do the job for you.

5343048--539265--upload_2020-1-6_13-44-11.png

Otherwise, you could try making a temporary vcam with DoNothing everywhere, placing it appropriately, and calling freeLook.OnTransitionFromCamera manually with the temp vcam as the fromCamera. Make sure the freeLook has InheritPosition checked. That will make freeLook choose the best axis values to match fromCamera’s position.

Let me know if that works for you.

Thank you