CinemachineStateDrivenCamera documentation/explanation?

Hi,
I want to use CinemachineStateDrivenCamera but I can’t find documentation on how it works (overall and how Animator’s state maps with camera exactly), Google returns null. Any pointers on that matter?

Thanks!

Yeah, we’re a little lean on the doc… working on catching up.

So, assuming you have an asset that is a State Machine, e.g:

3203899--245003--upload_2017-8-31_9-0-18.png

You then create a CinemachineStateDrivenCamera and connect the FSM to its Animated Target:

3203899--245004--upload_2017-8-31_9-2-50.png

Next, create some state-to-camera mappings. You do that by clicking on the little + icon in the state list:

3203899--245005--upload_2017-8-31_9-5-23.png

This will add an entry in the state list, and you can then choose the state you want to handle, and the virtual camera child to map it to.

3203899--245006--upload_2017-8-31_9-6-51.png

The available cameras are the virtual camera children of the StateDrivenCamera. Create as many as you like, of whatever variety you need. You can use the hierarchy view to reparent externally-created vcams to the StateDrivenCamera, if you like, or just press the little + on the camera list to create a standard one. When you do, those cameras will become available for mapping.

You will end up with something like this:

So now, when the states in the list become active, the associated child cameras will also become active. They will blend in using the default blend setting defined in the StateDrivenCamera. You can also create custom blends for specific pairs by creating a custom blend asset on the StateDrivenCamera.

That should be enough to get you going.

1 Like

Thank you!
It wasn’t obvious for me how it works so this is very helpful


(side note for non-coders)
This list includes two additional parameters but without working tooltips yet (at least I personally couldn’t make it to show up), so reading from source code:
Wait - “How long to wait (in seconds) before activating the virtual camera. This filters out very short state durations”
Min - “The minimum length of time (in seconds) to keep a virtual camera active”

1 Like

Is there anyway to switch to a camera via a Mesh collider trigger? Or does it have to be an animation state on the player controller?

thanks,
rich

Within the SDC, the camera child is chosen based on the animation state. If you need to manually choose the vcam based on another criterion, the way to do it is to have another vcam, outside the SDC, and blend to that.