Struct ReadWriteTransformHandle
Read/write handle on a Transform component used in Animation C# Jobs.
Namespace: UnityEngine.Animations.Rigging
Syntax
public struct ReadWriteTransformHandle
Methods
Bind(Animator, Transform)
Create a ReadWriteTransformHandle representing the new binding between the Animator and a Transform already bound to the Animator.
Declaration
public static ReadWriteTransformHandle 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 |
---|---|
ReadWriteTransformHandle | Returns the ReadWriteTransformHandle that represents the new binding. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if transform is null. |
InvalidOperationException | Thrown if transform is not a child in the Animator hierarchy. |
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. |
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 ReadWriteTransformHandle 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 ReadWriteTransformHandle 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 ReadWriteTransformHandle 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. |
See Also
SetGlobalTR(AnimationStream, Vector3, Quaternion, Boolean)
Sets the position and rotation of the transform in world space.
Declaration
public void SetGlobalTR(AnimationStream stream, Vector3 position, Quaternion rotation, bool useMask = false)
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. |
Boolean | useMask | Set to true to write the specified parameters if the matching stream parameters have not already been modified. |
SetLocalPosition(AnimationStream, Vector3)
Sets the position of the transform relative to the parent.
Declaration
public void SetLocalPosition(AnimationStream stream, Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Vector3 | position | The position of the transform relative to the parent. |
SetLocalRotation(AnimationStream, Quaternion)
Sets the rotation of the transform relative to the parent.
Declaration
public void SetLocalRotation(AnimationStream stream, Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Quaternion | rotation | The rotation of the transform relative to the parent. |
SetLocalScale(AnimationStream, Vector3)
Sets the scale of the transform relative to the parent.
Declaration
public void SetLocalScale(AnimationStream stream, Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Vector3 | scale | The scale of the transform relative to the parent. |
SetLocalTRS(AnimationStream, Vector3, Quaternion, Vector3, Boolean)
Sets the position, rotation and scale of the transform relative to the parent.
Declaration
public void SetLocalTRS(AnimationStream stream, Vector3 position, Quaternion rotation, Vector3 scale, bool useMask = false)
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. |
Boolean | useMask | Set to true to write the specified parameters if the matching stream parameters have not already been modified. |
SetPosition(AnimationStream, Vector3)
Sets the position of the transform in world space.
Declaration
public void SetPosition(AnimationStream stream, Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Vector3 | position | The position of the transform in world space. |
SetRotation(AnimationStream, Quaternion)
Sets the rotation of the transform in world space.
Declaration
public void SetRotation(AnimationStream stream, Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
AnimationStream | stream | The AnimationStream that holds the animated values. |
Quaternion | rotation | The rotation of the transform in world space. |