Class BindPose

Namespace
CodeSmile.AnyMotion.Core.Rig
/
Assembly
ApiSource.dll

The pose a rig was skinned in, read from the mesh's own bind pose matrices rather than from the rig's current state in the scene.

public sealed class BindPose
Expand Details ...
Inheritance
object
BindPose

Remarks

Every part of this system needs a fixed reference pose: measurement needs it to report heights, and the driver spaces need it as the state they restore before writing, so each frame's write is absolute rather than applied on top of the previous frame.

Taking that reference from the live Transforms is unsafe. Anything that re-reads it while the rig is mid-animation adopts the animated pose as the reference, and from then on rotations compound on a pose that already contained a frame of gait. A domain reload after a script recompile does exactly that, so the error accumulates every time the code is edited, which looks like the animation slowly becoming stranger.

SkinnedMeshRenderer.sharedMesh.bindposes is immune to all of that: it is asset data, fixed at import, and describes the pose the vertices were weighted against. Reading it costs nothing at runtime and cannot be polluted by the scene.

Properties

KnownBoneCount

Number of Humanoid bones a bind pose was recovered for.

public int KnownBoneCount { get; }

Property Value

int

Source

Where the values came from, for display in the inspector.

public string Source { get; }

Property Value

string

Methods

Apply(Animator)

Writes this pose onto the rig's Transforms.

public void Apply(Animator animator)

Parameters

Type Name Description
Animator
animator

FromMecanimTPose(Animator)

Recovers the reference pose by zeroing every Mecanim muscle value, which produces the Avatar's T-pose. Fallback for rigs with no skinned mesh, and less trustworthy: it needs the scene rig to be mutated in order to read it, and it depends on the Avatar being configured correctly.

public static BindPose FromMecanimTPose(Animator animator)

Parameters

Type Name Description
Animator
animator

Returns

BindPose

FromMesh(Animator)

Recovers the bind pose from every UnityEngine.SkinnedMeshRenderer under animator. Returns null when the rig has no skinned mesh to read from.

public static BindPose FromMesh(Animator animator)

Parameters

Type Name Description
Animator
animator

Returns

BindPose

Has(HumanBodyBones)

public bool Has(HumanBodyBones bone)

Parameters

Type Name Description
HumanBodyBones
bone

Returns

bool

LocalPosition(HumanBodyBones)

public Vector3 LocalPosition(HumanBodyBones bone)

Parameters

Type Name Description
HumanBodyBones
bone

Returns

Vector3

LocalRotation(HumanBodyBones)

public Quaternion LocalRotation(HumanBodyBones bone)

Parameters

Type Name Description
HumanBodyBones
bone

Returns

Quaternion

Resolve(Animator)

Mesh bind pose when available, Mecanim T-pose otherwise.

public static BindPose Resolve(Animator animator)

Parameters

Type Name Description
Animator
animator

Returns

BindPose