Class MusclePoseSystem
Muscle-based pose system - HELPER layer only Never writes to AnimationClip directly Forwards all bone transforms to BonePoseSystem
public class MusclePoseSystem
- Inheritance
-
MusclePoseSystem
- Inherited Members
Constructors
MusclePoseSystem(Animator, SkeletonCache, BonePoseSystem)
public MusclePoseSystem(Animator animator, SkeletonCache skeleton, BonePoseSystem bonePoseSystem)
Parameters
animatorAnimatorskeletonSkeletonCachebonePoseSystemBonePoseSystem
Properties
MuscleValues
public float[] MuscleValues { get; }
Property Value
- float[]
Methods
ConstrainAndApply(bool)
Full muscle-based IK result pipeline — the ONLY correct way to apply IK on a Humanoid rig so that joint limits are enforced and the muscle editor stays in sync.
Pipeline:
- GetHumanPose → converts bone transforms → normalised muscle values. Unity auto-clamps each value to [−1, 1], which is the humanoid joint-limit enforcement.
- muscleValues[] is updated so the Muscle Editor UI reflects the result.
- SetHumanPose → writes the clamped muscles back to bone transforms. This is identical to what Animation Rigging does internally after its own IK passes.
- All bone rotations AND the root (Hips) position are forwarded to the authoritative BonePoseSystem.
- CommitPose is called (conditionally) to write animation keys.
public void ConstrainAndApply(bool commitPose = true)
Parameters
commitPosebool
GetHumanPose()
Get the current HumanPose with latest muscle values
public HumanPose GetHumanPose()
Returns
- HumanPose
GetMuscleLimits(int)
Get muscle limits
public Vector2 GetMuscleLimits(int index)
Parameters
indexint
Returns
- Vector2
GetMuscleName(int)
Get muscle name for UI display
public string GetMuscleName(int index)
Parameters
indexint
Returns
ResetToTPose(bool)
Reset all muscles to T-Pose (0 values)
public void ResetToTPose(bool autoKey = true)
Parameters
autoKeybool
SetAllMuscles(float[], bool)
Set all muscle values at once
public void SetAllMuscles(float[] values, bool autoKey = true)
Parameters
SetMuscle(int, float, bool)
Set a specific muscle value and apply to skeleton Forwards resulting bone rotations to BonePoseSystem
public void SetMuscle(int muscleIndex, float value, bool autoKey = true)
Parameters
SyncFromSkeleton()
Read current skeleton state into muscle values
public void SyncFromSkeleton()