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

    Class CinemachineTargetGroup

    Defines a group of target objects, each with a radius and a weight. The weight is used when calculating the average position of the target group. Higher-weighted members of the group will count more. The bounding box is calculated by taking the member positions, weight, and radii into account.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    CinemachineTargetGroup
    Inherited Members
    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)]
    [AddComponentMenu("Cinemachine/CinemachineTargetGroup")]
    [ExecuteInEditMode]
    public class CinemachineTargetGroup : MonoBehaviour, ICinemachineTargetGroup

    Fields

    m_PositionMode

    How the group's position is calculated

    Declaration
    [Tooltip("How the group's position is calculated.  Select GroupCenter for the center of the bounding box, and GroupAverage for a weighted average of the positions of the members.")]
    public CinemachineTargetGroup.PositionMode m_PositionMode
    Field Value
    Type Description
    CinemachineTargetGroup.PositionMode

    m_RotationMode

    How the group's orientation is calculated

    Declaration
    [Tooltip("How the group's rotation is calculated.  Select Manual to use the value in the group's transform, and GroupAverage for a weighted average of the orientations of the members.")]
    public CinemachineTargetGroup.RotationMode m_RotationMode
    Field Value
    Type Description
    CinemachineTargetGroup.RotationMode

    m_Targets

    The target objects, together with their weights and radii, that will contribute to the group's average position, orientation, and size

    Declaration
    [Tooltip("The target objects, together with their weights and radii, that will contribute to the group's average position, orientation, and size.")]
    public CinemachineTargetGroup.Target[] m_Targets
    Field Value
    Type Description
    CinemachineTargetGroup.Target[]

    m_UpdateMethod

    When to update the group's transform based on the position of the group members

    Declaration
    [Tooltip("When to update the group's transform based on the position of the group members")]
    public CinemachineTargetGroup.UpdateMethod m_UpdateMethod
    Field Value
    Type Description
    CinemachineTargetGroup.UpdateMethod

    Properties

    BoundingBox

    The axis-aligned bounding box of the group, computed using the targets positions and radii

    Declaration
    public Bounds BoundingBox { get; }
    Property Value
    Type Description
    Bounds
    Implements
    ICinemachineTargetGroup.BoundingBox

    IsEmpty

    Return true if there are no members with weight > 0

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    Boolean
    Implements
    ICinemachineTargetGroup.IsEmpty

    Sphere

    The bounding sphere of the group, computed using the targets positions and radii

    Declaration
    public BoundingSphere Sphere { get; }
    Property Value
    Type Description
    BoundingSphere
    Implements
    ICinemachineTargetGroup.Sphere

    Transform

    Get the MonoBehaviour's Transform

    Declaration
    public Transform Transform { get; }
    Property Value
    Type Description
    Transform
    Implements
    ICinemachineTargetGroup.Transform

    Methods

    AddMember(Transform, Single, Single)

    Add a member to the group

    Declaration
    public void AddMember(Transform t, float weight, float radius)
    Parameters
    Type Name Description
    Transform t
    Single weight
    Single radius

    DoUpdate()

    Update the group's transform right now, depending on the transforms of the members. Normally this is called automatically by Update() or LateUpdate().

    Declaration
    public void DoUpdate()

    FindMember(Transform)

    Locate a member's index in the group. Returns -1 if not a member

    Declaration
    public int FindMember(Transform t)
    Parameters
    Type Name Description
    Transform t
    Returns
    Type Description
    Int32

    GetViewSpaceAngularBounds(Matrix4x4, out Vector2, out Vector2, out Vector2)

    Get the local-space angular bounds of the group, from a spoecific point of view. Also returns the z depth range of the members.

    Declaration
    public void GetViewSpaceAngularBounds(Matrix4x4 observer, out Vector2 minAngles, out Vector2 maxAngles, out Vector2 zRange)
    Parameters
    Type Name Description
    Matrix4x4 observer

    Point of view from which to calculate, and in whose space the return values are

    Vector2 minAngles

    The lower bound of the screen angles of the members (degrees)

    Vector2 maxAngles

    The upper bound of the screen angles of the members (degrees)

    Vector2 zRange

    The min and max depth values of the members, relative to the observer

    Implements
    ICinemachineTargetGroup.GetViewSpaceAngularBounds(Matrix4x4, out Vector2, out Vector2, out Vector2)

    GetViewSpaceBoundingBox(Matrix4x4)

    The axis-aligned bounding box of the group, in a specific reference frame

    Declaration
    public Bounds GetViewSpaceBoundingBox(Matrix4x4 observer)
    Parameters
    Type Name Description
    Matrix4x4 observer

    The frame of reference in which to compute the bounding box

    Returns
    Type Description
    Bounds

    The axis-aligned bounding box of the group, in the desired frame of reference

    Implements
    ICinemachineTargetGroup.GetViewSpaceBoundingBox(Matrix4x4)

    GetWeightedBoundsForMember(Int32)

    Get the bounding sphere of a group memebr, with the weight taken into account. As the member's weight goes to 0, the position lerps to the group average position.

    Declaration
    public BoundingSphere GetWeightedBoundsForMember(int index)
    Parameters
    Type Name Description
    Int32 index

    Member index

    Returns
    Type Description
    BoundingSphere

    RemoveMember(Transform)

    Remove a member from the group

    Declaration
    public void RemoveMember(Transform t)
    Parameters
    Type Name Description
    Transform t
    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