Class SoleGeometry

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

The drawn geometry of both feet, reduced to the few vertices that can ever be the lowest one, so the height of a sole above the ground can be evaluated every frame without reading the mesh.

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

Remarks

The sole-height compensation in IkTargetSpaceDriver places a candidate pose whenever it needs a sole height, and IkTargetSpaceDriver.LastSoleEvaluations counts those poses. Assets/Plan/engineering/implementation-notes.md → L05 sole-height compensation owns the measured range and this remark does not restate it. Skinning every foot vertex once per candidate pose is not affordable, and reading the mesh at all is not possible in a player build: a model imported with Read/Write off — Unity's default, and the setting on this project's own Kyle-1000 rig — returns no vertices at run time.

Both problems have the same answer. A sole vertex is weighted almost entirely to one bone — the foot or a toe — so its position in that bone's local space is fixed, and it can be measured once in the Editor, where a non-readable mesh can still be read, and stored on RigMetrics. The lowest world vertex of a rigid point set is the set's support point in the world-down direction, and only the convex hull's vertices can ever be a support point, so the stored set is reduced to the points that are extreme in at least one of ReductionDirections sampled directions. What is left is a few dozen points per foot, and evaluating the sole height is one matrix per bone plus one transform per point.

A vertex whose dominant weight is below MinimumDominantWeight is dropped rather than approximated, and a vertex weighted to a bone outside a foot is never considered. The lowest point of a foot is on its sole, where the weight is 1 on a real rig; the blended vertices are around the ankle, well above it.

Fields

MinimumDominantWeight

Smallest single-bone weight a vertex may have and still be treated as rigidly attached to that bone. Below this the vertex is dropped.

public const float MinimumDominantWeight = 0.5

Field Value

float

ReductionDirections

How many directions the reduction samples. Each contributes the one point extreme along it, so a higher count keeps more points and misses fewer, and Source records how far the reduction was ever wrong on the rig it was measured from. Raising this from 512 to 2048 took that figure from 2.000 mm to 0.476 mm on Kyle-1000 and from 3.308 mm to 0.831 mm on SyntyZombie, while the kept point count rose by 5 to 8 points per rig — so it costs the per-frame evaluation almost nothing and only the one-off measurement more.

public const int ReductionDirections = 2048

Field Value

int

Methods

Bind(Animator, SoleGeometryData)

Resolves stored bone paths against a live rig. Returns null when data is missing or empty, or when no path resolves.

public static SoleGeometry Bind(Animator animator, SoleGeometryData data)

Parameters

Type Name Description
Animator
animator
SoleGeometryData
data

Returns

SoleGeometry

Measure(Animator)

Reads every skinned mesh under animator that can be read and reduces the two feet's vertices as the class remarks describe. Returns null when nothing could be read, so a caller can keep whatever it measured earlier rather than replacing it with nothing.

public static SoleGeometryData Measure(Animator animator)

Parameters

Type Name Description
Animator
animator

Returns

SoleGeometryData

Remarks

Call this from the Editor outside play mode. Measure() is the only caller and it skips this while Application.isPlaying is true, so the measurement runs once per Editor Measure and the result a spawn uses is the serialized one. A mesh imported with Read/Write off can be read in the Editor and cannot be read in a player, which is why the result is serialized rather than produced at run time.

PointCount(bool)

How many points this foot is evaluated from.

public int PointCount(bool left)

Parameters

Type Name Description
bool
left

Returns

int

TryGetLowestPoint(bool, out Vector3)

Lowest drawn point of one foot, in world space.

public bool TryGetLowestPoint(bool left, out Vector3 lowestWorld)

Parameters

Type Name Description
bool
left
Vector3
lowestWorld

Returns

bool