Class CinemachineMixingCamera | Cinemachine | 2.5.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class CinemachineMixingCamera

    CinemachineMixingCamera is a "manager camera" that takes on the state of the weighted average of the states of its child virtual cameras.

    A fixed number of slots are made available for cameras, rather than a dynamic array. We do it this way in order to support weight animation from the Timeline. Timeline cannot animate array elements.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    CinemachineVirtualCameraBase
    CinemachineMixingCamera
    Inherited Members
    CinemachineVirtualCameraBase.m_ExcludedPropertiesInInspector
    CinemachineVirtualCameraBase.m_LockStageInInspector
    CinemachineVirtualCameraBase.ValidatingStreamVersion
    CinemachineVirtualCameraBase.m_Priority
    CinemachineVirtualCameraBase.m_StandbyUpdate
    CinemachineVirtualCameraBase.AddExtension(CinemachineExtension)
    CinemachineVirtualCameraBase.RemoveExtension(CinemachineExtension)
    CinemachineVirtualCameraBase.InvokePostPipelineStageCallback(CinemachineVirtualCameraBase, CinemachineCore.Stage, CameraState, Single)
    CinemachineVirtualCameraBase.InvokeOnTransitionInExtensions(ICinemachineCamera, Vector3, Single)
    CinemachineVirtualCameraBase.Name
    CinemachineVirtualCameraBase.Description
    CinemachineVirtualCameraBase.Priority
    CinemachineVirtualCameraBase.ApplyPositionBlendMethod(CameraState, CinemachineVirtualCameraBase.BlendHint)
    CinemachineVirtualCameraBase.VirtualCameraGameObject
    CinemachineVirtualCameraBase.IsValid
    CinemachineVirtualCameraBase.ParentCamera
    CinemachineVirtualCameraBase.PreviousStateIsValid
    CinemachineVirtualCameraBase.UpdateCameraState(Vector3, Single)
    CinemachineVirtualCameraBase.OnDestroy()
    CinemachineVirtualCameraBase.OnTransformParentChanged()
    CinemachineVirtualCameraBase.Start()
    CinemachineVirtualCameraBase.OnDisable()
    CinemachineVirtualCameraBase.Update()
    CinemachineVirtualCameraBase.ResolveLookAt(Transform)
    CinemachineVirtualCameraBase.ResolveFollow(Transform)
    CinemachineVirtualCameraBase.MoveToTopOfPrioritySubqueue()
    CinemachineVirtualCameraBase.CreateBlend(ICinemachineCamera, ICinemachineCamera, CinemachineBlendDefinition, CinemachineBlend)
    CinemachineVirtualCameraBase.PullStateFromVirtualCamera(Vector3, LensSettings)
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, Boolean)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: Cinemachine
    Syntax
    [DocumentationSorting(DocumentationSortingAttribute.Level.UserRef)]
    [DisallowMultipleComponent]
    [ExecuteInEditMode]
    [ExcludeFromPreset]
    [AddComponentMenu("Cinemachine/CinemachineMixingCamera")]
    public class CinemachineMixingCamera : CinemachineVirtualCameraBase, ICinemachineCamera

    Fields

    m_Weight0

    Weight of the first tracked camera

    Declaration
    [Tooltip("The weight of the first tracked camera")]
    public float m_Weight0
    Field Value
    Type Description
    Single

    m_Weight1

    Weight of the second tracked camera

    Declaration
    [Tooltip("The weight of the second tracked camera")]
    public float m_Weight1
    Field Value
    Type Description
    Single

    m_Weight2

    Weight of the third tracked camera

    Declaration
    [Tooltip("The weight of the third tracked camera")]
    public float m_Weight2
    Field Value
    Type Description
    Single

    m_Weight3

    Weight of the fourth tracked camera

    Declaration
    [Tooltip("The weight of the fourth tracked camera")]
    public float m_Weight3
    Field Value
    Type Description
    Single

    m_Weight4

    Weight of the fifth tracked camera

    Declaration
    [Tooltip("The weight of the fifth tracked camera")]
    public float m_Weight4
    Field Value
    Type Description
    Single

    m_Weight5

    Weight of the sixth tracked camera

    Declaration
    [Tooltip("The weight of the sixth tracked camera")]
    public float m_Weight5
    Field Value
    Type Description
    Single

    m_Weight6

    Weight of the seventh tracked camera

    Declaration
    [Tooltip("The weight of the seventh tracked camera")]
    public float m_Weight6
    Field Value
    Type Description
    Single

    m_Weight7

    Weight of the eighth tracked camera

    Declaration
    [Tooltip("The weight of the eighth tracked camera")]
    public float m_Weight7
    Field Value
    Type Description
    Single

    MaxCameras

    The maximum number of tracked cameras. If you want to add more cameras, do it here in the source code, and be sure to add the extra member variables and to make the appropriate changes in GetWeight() and SetWeight(). The inspector will figure itself out based on this value.

    Declaration
    public const int MaxCameras = 8
    Field Value
    Type Description
    Int32

    Properties

    ChildCameras

    Get the cached list of child cameras. These are just the immediate children in the hierarchy. Note: only the first entries of this list participate in the final blend, up to MaxCameras

    Declaration
    public CinemachineVirtualCameraBase[] ChildCameras { get; }
    Property Value
    Type Description
    CinemachineVirtualCameraBase[]

    Follow

    Not used

    Declaration
    public override Transform Follow { get; set; }
    Property Value
    Type Description
    Transform
    Overrides
    CinemachineVirtualCameraBase.Follow

    LookAt

    Not used

    Declaration
    public override Transform LookAt { get; set; }
    Property Value
    Type Description
    Transform
    Overrides
    CinemachineVirtualCameraBase.LookAt

    State

    The blended CameraState

    Declaration
    public override CameraState State { get; }
    Property Value
    Type Description
    CameraState
    Overrides
    CinemachineVirtualCameraBase.State

    Methods

    GetWeight(CinemachineVirtualCameraBase)

    Get the weight of the child CinemachineVirtualCameraBase.

    Declaration
    public float GetWeight(CinemachineVirtualCameraBase vcam)
    Parameters
    Type Name Description
    CinemachineVirtualCameraBase vcam

    The child camera.

    Returns
    Type Description
    Single

    The weight of the camera. Valid only if camera is active and enabled.

    GetWeight(Int32)

    Get the weight of the child at an index.

    Declaration
    public float GetWeight(int index)
    Parameters
    Type Name Description
    Int32 index

    The child index. Only immediate CinemachineVirtualCameraBase children are counted.

    Returns
    Type Description
    Single

    The weight of the camera. Valid only if camera is active and enabled.

    InternalUpdateCameraState(Vector3, Single)

    Internal use only. Do not call this methid. Called by CinemachineCore at designated update time so the vcam can position itself and track its targets. This implementation computes and caches the weighted blend of the tracked cameras.

    Declaration
    public override void InternalUpdateCameraState(Vector3 worldUp, float deltaTime)
    Parameters
    Type Name Description
    Vector3 worldUp

    Default world Up, set by the CinemachineBrain

    Single deltaTime

    Delta time for time-based effects (ignore if less than 0)

    Overrides
    CinemachineVirtualCameraBase.InternalUpdateCameraState(Vector3, Single)

    InvalidateListOfChildren()

    Invalidate the cached list of child cameras.

    Declaration
    protected void InvalidateListOfChildren()

    IsLiveChild(ICinemachineCamera, Boolean)

    Check whether the vcam a live child of this camera.

    Declaration
    public override bool IsLiveChild(ICinemachineCamera vcam, bool dominantChildOnly = false)
    Parameters
    Type Name Description
    ICinemachineCamera vcam

    The Virtual Camera to check

    Boolean dominantChildOnly

    If truw, will only return true if this vcam is the dominat live child

    Returns
    Type Description
    Boolean

    True if the vcam is currently actively influencing the state of this vcam

    Overrides
    CinemachineVirtualCameraBase.IsLiveChild(ICinemachineCamera, Boolean)

    OnEnable()

    Makes sure the internal child cache is up to date

    Declaration
    protected override void OnEnable()
    Overrides
    CinemachineVirtualCameraBase.OnEnable()

    OnTargetObjectWarped(Transform, Vector3)

    This is called to notify the vcam that a target got warped, so that the vcam can update its internal state to make the camera also warp seamlessy.

    Declaration
    public override void OnTargetObjectWarped(Transform target, Vector3 positionDelta)
    Parameters
    Type Name Description
    Transform target

    The object that was warped

    Vector3 positionDelta

    The amount the target's position changed

    Overrides
    CinemachineVirtualCameraBase.OnTargetObjectWarped(Transform, Vector3)

    OnTransformChildrenChanged()

    Makes sure the internal child cache is up to date

    Declaration
    public void OnTransformChildrenChanged()

    OnTransitionFromCamera(ICinemachineCamera, Vector3, Single)

    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

    Single deltaTime

    Delta time for time-based effects (ignore if less than or equal to 0)

    Overrides
    CinemachineVirtualCameraBase.OnTransitionFromCamera(ICinemachineCamera, Vector3, Single)

    OnValidate()

    Makes sure the weights are non-negative

    Declaration
    protected override void OnValidate()
    Overrides
    CinemachineVirtualCameraBase.OnValidate()

    SetWeight(CinemachineVirtualCameraBase, Single)

    Set the weight of the child CinemachineVirtualCameraBase.

    Declaration
    public void SetWeight(CinemachineVirtualCameraBase vcam, float w)
    Parameters
    Type Name Description
    CinemachineVirtualCameraBase vcam

    The child camera.

    Single w

    The weight to set. Can be any non-negative number.

    SetWeight(Int32, Single)

    Set the weight of the child at an index.

    Declaration
    public void SetWeight(int index, float w)
    Parameters
    Type Name Description
    Int32 index

    The child index. Only immediate CinemachineVirtualCameraBase children are counted.

    Single w

    The weight to set. Can be any non-negative number.

    ValidateListOfChildren()

    Rebuild the cached list of child cameras.

    Declaration
    protected void ValidateListOfChildren()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023