Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


MuscleHandle

Handle for a muscle in the AnimationHumanStream.
Read time 1 minuteLast updated 6 days ago

Definition

public struct MuscleHandle

Remarks

MuscleHandle can only be used on AnimationHumanStream, otherwise an
InvalidOperationException
is thrown.

Examples

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)The different constructors that creates the muscle handle.
MuscleHandle(UnityEngine.HeadDof)The different constructors that creates the muscle handle.
MuscleHandle(UnityEngine.HumanPartDof,UnityEngine.ArmDof)The different constructors that creates the muscle handle.
MuscleHandle(UnityEngine.HumanPartDof,UnityEngine.FingerDof)The different constructors that creates the muscle handle.
MuscleHandle(UnityEngine.HumanPartDof,UnityEngine.LegDof)The different constructors that creates the muscle handle.

Properties

Property

Description

dofThe muscle human sub-part. (Read Only)
humanPartDofThe muscle human part. (Read Only)
nameThe name of the muscle. (Read Only)

Static Properties

Property

Description

muscleHandleCountThe total number of DoF parts in a humanoid. (Read Only)

Static Methods

Method

Description

GetMuscleHandlesFills the array with all the possible muscle handles on a humanoid.