Struct ReadOnlyTransformHandle
Read-only handle on a Transform component used in Animation C# Jobs.
Namespace: UnityEngine.Animations.Rigging
Syntax
public struct ReadOnlyTransformHandle
Methods
Bind(Animator, Transform)
Create a ReadOnlyTransformHandle representing the new binding between the Animator and a Transform already bound to the Animator.
Declaration
public static ReadOnlyTransformHandle Bind(Animator animator, Transform transform)
Parameters
Type | Name | Description |
---|---|---|
Animator | animator | The Animator on which to bind the new handle. |
Transform | transform | The Transform to bind. |
Returns
Type | Description |
---|---|
ReadOnlyTransformHandle | Returns the ReadOnlyTransformHandle that represents the new binding. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if transform is null. |
GetGlobalTR(AnimationStream, out Vector3, out Quaternion)
Gets the position and scaled rotation of the transform in world space.
Declaration
public void GetGlobalTR(AnimationStream stream, out Vector3 position, out Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Vector3 | position | The position of the transform in world space. |
Quaternion | rotation | The rotation of the transform in world space. |
GetLocalPosition(AnimationStream)
Gets the position of the transform relative to the parent.
Declaration
public Vector3 GetLocalPosition(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Returns
Type | Description |
---|---|
Vector3 | The position of the transform relative to the parent. |
GetLocalRotation(AnimationStream)
Gets the rotation of the transform relative to the parent.
Declaration
public Quaternion GetLocalRotation(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Returns
Type | Description |
---|---|
Quaternion | The rotation of the transform relative to the parent. |
GetLocalScale(AnimationStream)
Gets the scale of the transform relative to the parent.
Declaration
public Vector3 GetLocalScale(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Returns
Type | Description |
---|---|
Vector3 | The scale of the transform relative to the parent. |
GetLocalToParentMatrix(AnimationStream)
Gets the matrix of the transform in local space.
Declaration
public Matrix4x4 GetLocalToParentMatrix(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Returns
Type | Description |
---|---|
Matrix4x4 | The matrix of the transform in local space. |
GetLocalToWorldMatrix(AnimationStream)
Gets the matrix of the transform in world space.
Declaration
public Matrix4x4 GetLocalToWorldMatrix(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Returns
Type | Description |
---|---|
Matrix4x4 | The matrix of the transform in world space. |
GetLocalTRS(AnimationStream, out Vector3, out Quaternion, out Vector3)
Gets the position, rotation and scale of the transform relative to the parent.
Declaration
public void GetLocalTRS(AnimationStream stream, out Vector3 position, out Quaternion rotation, out Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Vector3 | position | The position of the transform relative to the parent. |
Quaternion | rotation | The rotation of the transform relative to the parent. |
Vector3 | scale | The scale of the transform relative to the parent. |
GetPosition(AnimationStream)
Gets the position of the transform in world space.
Declaration
public Vector3 GetPosition(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Returns
Type | Description |
---|---|
Vector3 | The position of the transform in world space. |
GetRotation(AnimationStream)
Gets the rotation of the transform in world space.
Declaration
public Quaternion GetRotation(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Returns
Type | Description |
---|---|
Quaternion | The rotation of the transform in world space. |
IsResolved(AnimationStream)
Returns whether this handle is resolved. A ReadOnlyTransformHandle is resolved if it is valid, if it has the same bindings version than the one in the stream, and if it is bound to the transform in the stream. A ReadOnlyTransformHandle can become unresolved if the animator bindings have changed or if the transform had been destroyed.
Declaration
public bool IsResolved(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the handle is resolved, false otherwise. |
See Also
IsValid(AnimationStream)
Returns whether this is a valid handle. A ReadOnlyTransformHandle may be invalid if, for example, you didn't use the correct function to create it.
Declaration
public bool IsValid(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Returns
Type | Description |
---|---|
Boolean | Returns whether this is a valid handle. |
See Also
Resolve(AnimationStream)
Bind this handle with an animated values from the AnimationStream. Handles are lazily resolved as they're accessed, but in order to prevent unwanted CPU spikes, this method allows to resolve handles in a deterministic way.
Declaration
public void Resolve(AnimationStream stream)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |