Expand description
Locomotion clip metrics: loop-seam ratio, gait phase, root-motion speed. Ported from a production game pipeline’s reference implementation (verified there against Blender pose-matrix FK to <0.01×) — the algorithms are kept semantically identical so the numbers reproduce.
Structs§
- Foot
Cycle Metrics - Foot-cycle metrics for one sampled clip.
- Metric
Grids - Lazily sampled metric pose grids for one document.
Constants§
- MIN_
STRIDE_ STEP_ M - Below this per-frame foot move (metres), a clip has no real stride (idle / block / stationary action) and the seam ratio would be a divide-by-noise, so no ratio is reported.
Functions§
- circular_
phase_ spread - Maximum circular distance (in cycle fraction,
[0, 0.5]) of a set of normalized phases from their circular mean. Phases live on a ring, so a naive max−min would over-report a cluster straddling the 0/1 wrap. - foot_
cycle_ metrics - Measure the foot cycle of a clip from its pose grid. Requires the
Hips role and at least one foot role; returns
Noneotherwise (the caller decides whether that’s a skip-note or nothing). - fundamental_
trough_ phase - Normalized cycle position
[0,1)of the minimum of the signal’s first Fourier harmonic. Robust to plateaus and per-frame noise: the minimum ofA·cos(2π·t/N − φ)sits att/N = (φ/2π + 0.5) mod 1. - metric_
frame_ count - The metric sampling grid for a clip: uniform, resolution = max key
count (mirroring how the runtime loops a clip over
[0, duration], wrapping duration→0 at render times unaligned with authored keys).Nonefor clips too short to carry a cycle (< 3 keys), matching the reference implementation. - root_
motion_ speed_ mps - Horizontal (XZ-plane) root displacement over the clip, divided by duration. Uses the Root role, falling back to Hips (clips without a dedicated root bone carry travel on the hips).
- rotation_
range_ deg - Maximum angular deviation (degrees) of a rotation track from its first keyed rotation.