# TransformStreamHandle

> Position, rotation and scale of an object in the AnimationStream.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine.Animations](/engine/6000.5/script-reference/unityengine/animations.md)
* **Assembly:** UnityEngine.AnimationModule

```csharp
public struct TransformStreamHandle
```

## Remarks

```csharp
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Animations;

public struct TransformStreamHandleJob : IAnimationJob
{
    public TransformStreamHandle handle;
    public Vector3 position;
    public Vector3 rotation;
    public Vector3 scale;

    public void ProcessRootMotion(AnimationStream stream)
    {
        // Set the new local position.
        handle.SetLocalPosition(stream, position);

        // Set the new local rotation (converted from euler).
        handle.SetLocalRotation(stream, Quaternion.Euler(rotation));

        // Set the new local scale.
        handle.SetLocalScale(stream, scale);
    }

    public void ProcessAnimation(AnimationStream stream)
    {
    }
}

[RequireComponent(typeof(Animator))]
public class TransformStreamHandleExample : MonoBehaviour
{
    public Vector3 position;
    public Vector3 rotation;
    public Vector3 scale = Vector3.one;

    PlayableGraph m_Graph;
    AnimationScriptPlayable m_AnimationScriptPlayable;

    void Start()
    {
        var animator = GetComponent<Animator>();

        m_Graph = PlayableGraph.Create("TransformStreamHandleExample");
        var output = AnimationPlayableOutput.Create(m_Graph, "output", animator);

        var animationJob = new TransformStreamHandleJob();
        animationJob.handle = animator.BindStreamTransform(gameObject.transform);
        m_AnimationScriptPlayable = AnimationScriptPlayable.Create(m_Graph, animationJob);

        output.SetSourcePlayable(m_AnimationScriptPlayable);
        m_Graph.Play();
    }

    void Update()
    {
        var animationJob = m_AnimationScriptPlayable.GetJobData<TransformStreamHandleJob>();
        animationJob.position = position;
        animationJob.rotation = rotation;
        animationJob.scale = scale;
        m_AnimationScriptPlayable.SetJobData(animationJob);
    }

    void OnDisable()
    {
        m_Graph.Destroy();
    }
}
```

Additional Resources: [AnimatorJobExtensions.BindStreamTransform](/engine/6000.5/script-reference/unityengine/animations/animatorjobextensions/bindstreamtransform.md), [PropertyStreamHandle](/engine/6000.5/script-reference/unityengine/animations/propertystreamhandle.md), [PropertySceneHandle](/engine/6000.5/script-reference/unityengine/animations/propertyscenehandle.md), and [TransformSceneHandle](/engine/6000.5/script-reference/unityengine/animations/transformscenehandle.md).

## Methods

| Method                                                                                                                           | Description                                                                                                                                     |
| -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| [GetGlobalTR](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getglobaltr.md)                       | Gets the position and scaled rotation of the transform in world space.                                                                          |
| [GetLocalPosition](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getlocalposition.md)             | Gets the position of the transform relative to the parent.                                                                                      |
| [GetLocalRotation](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getlocalrotation.md)             | Gets the rotation of the transform relative to the parent.                                                                                      |
| [GetLocalScale](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getlocalscale.md)                   | Gets the scale of the transform relative to the parent.                                                                                         |
| [GetLocalToParentMatrix](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getlocaltoparentmatrix.md) | Gets the local to parent matrix of the transform.                                                                                               |
| [GetLocalToWorldMatrix](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getlocaltoworldmatrix.md)   | Gets the local to world matrix of the transform.                                                                                                |
| [GetLocalTRS](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getlocaltrs.md)                       | Gets the position, rotation and scale of the transform relative to the parent.                                                                  |
| [GetPosition](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getposition.md)                       | Gets the position of the transform in world space.                                                                                              |
| [GetPositionReadMask](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getpositionreadmask.md)       | Gets the position read mask of the transform.                                                                                                   |
| [GetRotation](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getrotation.md)                       | Gets the rotation of the transform in world space.                                                                                              |
| [GetRotationReadMask](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getrotationreadmask.md)       | Gets the rotation read mask of the transform.                                                                                                   |
| [GetScaleReadMask](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/getscalereadmask.md)             | Gets the scale read mask of the transform.                                                                                                      |
| [IsResolved](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/isresolved.md)                         | Returns whether this handle is resolved.                                                                                                        |
| [IsValid](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/isvalid.md)                               | Returns whether this is a valid handle.                                                                                                         |
| [Resolve](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/resolve.md)                               | Bind this handle with an animated values from the [AnimationStream](/engine/6000.5/script-reference/unityengine/animations/animationstream.md). |
| [SetGlobalTR](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/setglobaltr.md)                       | Sets the position and rotation of the transform in world space.                                                                                 |
| [SetLocalPosition](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/setlocalposition.md)             | Sets the position of the transform relative to the parent.                                                                                      |
| [SetLocalRotation](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/setlocalrotation.md)             | Sets the rotation of the transform relative to the parent.                                                                                      |
| [SetLocalScale](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/setlocalscale.md)                   | Sets the scale of the transform relative to the parent.                                                                                         |
| [SetLocalTRS](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/setlocaltrs.md)                       | Sets the position, rotation and scale of the transform relative to the parent.                                                                  |
| [SetPosition](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/setposition.md)                       | Sets the position of the transform in world space.                                                                                              |
| [SetRotation](/engine/6000.5/script-reference/unityengine/animations/transformstreamhandle/setrotation.md)                       | Sets the rotation of the transform in world space.                                                                                              |
