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.
Implements
Inherited Members
Namespace: Unity.Cinemachine
Assembly: solution.dll
Syntax
[AddComponentMenu("Cinemachine/Helpers/Cinemachine Target Group")]
[ExecuteAlways]
[DisallowMultipleComponent]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.cinemachine@3.0/manual/CinemachineTargetGroup.html")]
public class CinemachineTargetGroup : MonoBehaviour, ICinemachineTargetGroup
Fields
Name | Description |
---|---|
PositionMode | How the group's position is calculated |
RotationMode | How the group's orientation is calculated |
Targets | The target objects, together with their weights and radii, that will contribute to the group's average position, orientation, and size |
UpdateMethod | When to update the group's transform based on the position of the group members |
Properties
Name | Description |
---|---|
BoundingBox | The axis-aligned bounding box of the group, computed using the targets positions and radii |
IsEmpty | Return true if there are no members with weight > 0. This returns the cached member state and is only valid after a call to DoUpdate(). If members are added or removed after that call, this will not necessarily return correct information before the next update. |
IsValid | Returns true if object has not been deleted. |
Sphere | The bounding sphere of the group, computed using the targets positions and radii |
Transform | Get the MonoBehaviour's Transform |
m_Targets | Obsolete Targets |
Methods
Name | Description |
---|---|
AddMember(Transform, float, float) | Add a member to the group |
DoUpdate() | Update the group's transform right now, depending on the transforms of the members. Normally this is called automatically by Update() or LateUpdate(). |
FindMember(Transform) | Locate a member's index in the group. |
GetViewSpaceAngularBounds(Matrix4x4, out Vector2, out Vector2, out Vector2) | Get the local-space angular bounds of the group, from a specific point of view. Also returns the z depth range of the members. Note that this result is only valid after DoUpdate has been called. If members are added or removed after that call or change their weights or active state, this will not necessarily return correct information before the next update. |
GetViewSpaceBoundingBox(Matrix4x4, bool) | The axis-aligned bounding box of the group, in a specific reference frame. Note that this result is only valid after DoUpdate has been called. If members are added or removed after that call or change their weights or active state, this will not necessarily return correct information before the next update. |
GetWeightedBoundsForMember(int) | Get the bounding sphere of a group member, with the weight taken into account. As the member's weight goes to 0, the position interpolates to the group average position. Note that this result is only valid after DoUpdate has been called. If members are added or removed after that call or change their weights or active state, this will not necessarily return correct information before the next update. |
RemoveMember(Transform) | Remove a member from the group |