# MuscleHandle

> Handle for a muscle in the AnimationHumanStream.

## Definition

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

```csharp
public struct MuscleHandle
```

## Remarks

MuscleHandle can only be used on [AnimationHumanStream](/engine/6000.7/script-reference/unityengine/animations/animationhumanstream.md), otherwise an `InvalidOperationException` is thrown.

## Examples

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

public struct MuscleHandleExampleJob : IAnimationJob
{
    public MuscleHandle muscleHandle;

    public void ProcessRootMotion(AnimationStream stream) {}
    public void ProcessAnimation(AnimationStream stream)
    {
        AnimationHumanStream humanStream = stream.AsHuman();

        // Get a muscle value.
        float muscleValue = humanStream.GetMuscle(muscleHandle);

        // Set a muscle value.
        humanStream.SetMuscle(muscleHandle, muscleValue);
    }
}

[RequireComponent(typeof(Animator))]
public class MuscleHandleExample : MonoBehaviour
{
    void Start()
    {
        var graph = PlayableGraph.Create();
        var output = AnimationPlayableOutput.Create(graph, "output", GetComponent<Animator>());

        var job = new MuscleHandleExampleJob();
        job.muscleHandle = new MuscleHandle(HumanPartDof.LeftArm, ArmDof.HandDownUp);

        var scriptPlayable = AnimationScriptPlayable.Create(graph, job);
        output.SetSourcePlayable(scriptPlayable);

        graph.Evaluate(1.0f);

        graph.Destroy();
    }
}
```

## Constructors

| Constructor                                                                                                                                                                        | Description                                                |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| [MuscleHandle(UnityEngine.BodyDof)](/engine/6000.7/script-reference/unityengine/animations/musclehandle/ctor.md#musclehandle\(bodydof\))                                           | The different constructors that creates the muscle handle. |
| [MuscleHandle(UnityEngine.HeadDof)](/engine/6000.7/script-reference/unityengine/animations/musclehandle/ctor.md#musclehandle\(headdof\))                                           | The different constructors that creates the muscle handle. |
| [MuscleHandle(UnityEngine.HumanPartDof,UnityEngine.ArmDof)](/engine/6000.7/script-reference/unityengine/animations/musclehandle/ctor.md#musclehandle\(humanpartdof-armdof\))       | The different constructors that creates the muscle handle. |
| [MuscleHandle(UnityEngine.HumanPartDof,UnityEngine.FingerDof)](/engine/6000.7/script-reference/unityengine/animations/musclehandle/ctor.md#musclehandle\(humanpartdof-fingerdof\)) | The different constructors that creates the muscle handle. |
| [MuscleHandle(UnityEngine.HumanPartDof,UnityEngine.LegDof)](/engine/6000.7/script-reference/unityengine/animations/musclehandle/ctor.md#musclehandle\(humanpartdof-legdof\))       | The different constructors that creates the muscle handle. |

## Properties

| Property                                                                                            | Description                            |
| --------------------------------------------------------------------------------------------------- | -------------------------------------- |
| [dof](/engine/6000.7/script-reference/unityengine/animations/musclehandle/dof.md)                   | The muscle human sub-part. (Read Only) |
| [humanPartDof](/engine/6000.7/script-reference/unityengine/animations/musclehandle/humanpartdof.md) | The muscle human part. (Read Only)     |
| [name](/engine/6000.7/script-reference/unityengine/animations/musclehandle/name.md)                 | The name of the muscle. (Read Only)    |

## Static Properties

| Property                                                                                                      | Description                                              |
| ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| [muscleHandleCount](/engine/6000.7/script-reference/unityengine/animations/musclehandle/musclehandlecount.md) | The total number of DoF parts in a humanoid. (Read Only) |

## Static Methods

| Method                                                                                                      | Description                                                         |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| [GetMuscleHandles](/engine/6000.7/script-reference/unityengine/animations/musclehandle/getmusclehandles.md) | Fills the array with all the possible muscle handles on a humanoid. |
