Class CinemachineClearShot
Cinemachine ClearShot is a "manager camera" that owns and manages a set of Virtual Camera gameObject children. When Live, the ClearShot will check the children, and choose the one with the best quality shot and make it Live.
This can be a very powerful tool. If the child cameras have shot evaluator extensions, they will analyze the scene for target obstructions, optimal target distance, and other items, and report their assessment of shot quality back to the ClearShot parent, who will then choose the best one. You can use this to set up complex multi-camera coverage of a scene, and be assured that a clear shot of the target will always be available.
If multiple child cameras have the same shot quality, the one with the highest priority will be chosen.
You can also define custom blends between the ClearShot children.
Inheritance
Inherited Members
Namespace: Unity.Cinemachine
Assembly: Unity.Cinemachine.dll
Syntax
[DisallowMultipleComponent]
[ExecuteAlways]
[ExcludeFromPreset]
[AddComponentMenu("Cinemachine/Cinemachine ClearShot")]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/CinemachineClearShot.html")]
public class CinemachineClearShot : CinemachineCameraManagerBase, ICinemachineMixer, ICinemachineCamera
Fields
ActivateAfter
Wait this many seconds before activating a new child camera
Declaration
[Tooltip("Wait this many seconds before activating a new child camera")]
[FormerlySerializedAs("m_ActivateAfter")]
public float ActivateAfter
Field Value
Type | Description |
---|---|
float |
MinDuration
An active camera must be active for at least this many seconds
Declaration
[Tooltip("An active camera must be active for at least this many seconds")]
[FormerlySerializedAs("m_MinDuration")]
public float MinDuration
Field Value
Type | Description |
---|---|
float |
RandomizeChoice
If checked, camera choice will be randomized if multiple cameras are equally desirable.
Otherwise, child list order will be used
Declaration
[Tooltip("If checked, camera choice will be randomized if multiple cameras are equally desirable. Otherwise, child list order and child camera priority will be used.")]
[FormerlySerializedAs("m_RandomizeChoice")]
public bool RandomizeChoice
Field Value
Type | Description |
---|---|
bool |
Methods
ChooseCurrentCamera(Vector3, float)
Choose the appropriate current camera from among the ChildCameras, based on current state. If the returned camera is different from the current camera, an appropriate transition will be made.
Declaration
protected override CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worldUp, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | worldUp | Default world Up, set by the CinemachineBrain |
float | deltaTime | Delta time for time-based effects (ignore if less than or equal to 0) |
Returns
Type | Description |
---|---|
CinemachineVirtualCameraBase | The current child camera that should be active. Must be present in ChildCameras. |
Overrides
OnTransitionFromCamera(ICinemachineCamera, Vector3, float)
Notification that this virtual camera is going live.
Declaration
public override void OnTransitionFromCamera(ICinemachineCamera fromCam, Vector3 worldUp, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | fromCam | The camera being deactivated. May be null. |
Vector3 | worldUp | Default world Up, set by the CinemachineBrain |
float | deltaTime | Delta time for time-based effects (ignore if less than or equal to 0) |
Overrides
PerformLegacyUpgrade(int)
Override this to handle any upgrades necessitated by a streaming version change. Note that since this method is not called from the main thread, there are many things it cannot do, including checking a unity object for null.
Declaration
protected override void PerformLegacyUpgrade(int streamedVersion)
Parameters
Type | Name | Description |
---|---|---|
int | streamedVersion | The version that was streamed |
Overrides
Reset()
Reset the component to default values.
Declaration
protected override void Reset()
Overrides
ResetRandomization()
If RandomizeChoice is enabled, call this to re-randomize the children next frame. This is useful if you want to freshen up the shot.
Declaration
public void ResetRandomization()