Firstborn/Library/PackageCache/com.unity.cinemachine@2.8.9/Documentation~/CinemachineStateDrivenCamer...
Schaken-Mods b486678290 Library -Artifacts
Library -Artifacts
2023-03-28 12:24:16 -05:00

5.5 KiB
Raw Blame History

Cinemachine State-Driven Camera

The Cinemachine State-Driven Camera component activates a child Virtual Camera when an animation target changes states. For example, consider your avatars local-motion system and orbit camera. Your game feels more alive to the player when the camera shakes more as your avatar runs. When the avatar walks, blend for example to a Virtual Camera with more damping.

State-Driven camera with three child Virtual Cameras (red)

The animation target for a State-Driven Camera is a GameObject with an Animator component controlled by an Animator Controller.

Assign normal Look At and Follow targets to each child Virtual Camera. If a child Virtual Camera has no Look At or Follow target, State-Driven camera uses its own, respective targets.

State-Driven Camera has a list that assigns child Virtual Cameras to animation states. You can define default and custom blends between the State-Driven children.

In the Inspector, the State-Driven camera lists its Virtual Camera children. Use this list to add and delete child Virtual Cameras, and assign priorities.

Properties for Cinemachine State-Driven camera

To create a State-Driven camera:

  1. Set up the animation target GameObject to control it with an Animator Controller.

  2. In the Unity menu, choose GameObject > Cinemachine > State-Driven Camera.
    A new State-Driven camera appears in the hierarchy with a new child Virtual Camera.

  3. In the Inspector, assign the animation target you created in step 1 to the Animated Target property.

  4. If needed, add more child VIrtual Cameras either by clicking + in Virtual Camera Children or dragging and dropping existing Virtual Cameras in the Hierarchy window.

  5. Use the State to assign child Virtual Cameras to the animation states.

Properties:

Property: Function:
Solo Toggles whether or not the Virtual Camera is temporarily live. Use this property to get immediate visual feedback in the Game view to adjust the Virtual Camera.
Standby Update Controls how often the virtual camera is updated when the virtual camera is not live.
Game Window Guides Toggles the visibility of compositional guides in the Game view. These guides are available when Look At specifies a GameObject and the Aim section uses Composer or Group Composer, or when Follow specifies a target and the Body section uses Framing Composer. This property applies to all Virtual Cameras.
Save During Play Check to apply the changes while in Play mode. Use this feature to fine-tune a Virtual Camera without having to remember which properties to copy and paste. This property applies to all Virtual Cameras.
Priority The importance of this State-Driven camera for choosing the next shot. A higher value indicates a higher priority. This property has no effect when using a State-Driven camera with Timeline.
Look At The default target GameObject that the children Virtual Camera move with. The State-Driven camera uses this target when the child does not specify this target. May be empty if all of the children define targets of their own.
Follow The default target GameObject to aim the Unity camera at. The State-Driven camera uses this target when the child does not specify this target. May be empty if all of the children define targets of their own.
Animated Target The GameObject that contains the Animator Controller. The State-Drive camera reacts to the animation state changes from this GameObject.
Layer The animation layer to observe in the Animated Target.
Show Debug Text Check to display a textual summary of the live Virtual Camera and blend in the game view.
Default Blend The blend which is used if you dont explicitly define a blend between two Virtual Cameras.
Custom Blends The asset which contains custom settings for specific child blends.
State The state to which the virtual camera will be mapped.
Camera The virtual camera to activate for this state.
Wait The delay to activate the virtual camera (in seconds) once this state is entered. For example, the animation target moves from an active Walk state, to a Jog state, to a Run state. If the Jog Wait time is set to four seconds, the Walk virtual camera remains active for those four seconds even though the Jog state is now active. If the Jog state duration is less than the Wait time before the animation target passes into another state, the Jog virtual camera will not activate and is bypassed.
Min The minimum length of time (in seconds) the virtual camera must remain active once it is activated. For example, the animation target enters the Run state from the Jog state. It has spent five seconds in the Jog state before moving to the Run state. The Jog Min is set to 12 seconds. This means that the Jog virtual camera remains the active camera for an additional seven seconds even though the animation target is in the Run state.
Virtual Camera Children The list of Virtual Cameras that are children of the State-Driven camera.