Change Aim at Runtime

Hi guys, I’m trying to do something relatively simple but I just can’t figure out how.

I have a mixing camera, and temporarily I want to have it (well, its children) follow a target Transform. Simple enough, I loop through the child cameras and set the Follow and LookAt properties to the target transform.

HOWEVER this also causes the camera to rotate all over the place when the target transform turns, which is NOT behaviour that I want. So I figured I’d just change the Aim settings while following my target but this doesn’t seem to be an option from code? I can only change it manually in the inspector?

How do I follow something without rotating?

Update: even setting the Aim to “DoNothing” on the actual prefab so it’s always like this results in the camera spinning wildly around. Is there no way to simply follow something while maintaining angle/zoom/distance?

This is likely caused by the Binding Mode in the “Body” section of your vcams. If you have it set to “Lock to Target”, then the follow offset is calculated in target-local space, and will be affected by the target’s rotation. Try changing it to “World Space”. See this thread: Cinemachine goes crazy when following a Rigidbody

1 Like

Thank you very much for your help, that seems to have sorted it.

I’m not sure if these terms are more understandable to someone who works with real-world cameras or not but to a programmer it’s quite difficult to get your head around. I guess I expected some kind of “Rotate With Target” dropdown where I could choose “Yes - Rotate with Object, Yes - Rotate only in Y, No - Do not rotate” or something along those lines. Would be much easier than the current set up for me at least, just a suggestion :slight_smile:

We hear you, but the vocabulary is tricky here. Talking about “rotate” might be misleading because we’re not rotating the camera, we’re changing its position. The “Aim” section of the inspector is about rotating the camera. The question being answered by the Binding Mode dropdown is: “in what co-ordinate space is the offset to be applied?”.