1. Distance & Spine Constraints (Follow-the-Leader)
A creature spine consists of an array of N joints P0, P1, ..., PN-1 separated by fixed segment lengths Li.
The lead joint P0 is steered toward the movement target. Each subsequent joint Pi is constrained to remain at distance Li-1 from Pi-1:
v = Pi - Pi-1 | u = v / ||v|| | Pi = Pi-1 + u × Li-1
2. Angular Clamping (Anti-Collapse & Organic Curvature)
To prevent the spine from collapsing or pinching sharply during fast turns, we limit the change in angle Δθi between successive segments (Pi-1 − Pi-2) and (Pi − Pi-1) within [−θmax, +θmax]:
Δθi = atan2(sin(θi - θi-1), cos(θi - θi-1)) | θi' = θi-1 + clamp(Δθi, −θmax, +θmax)
3. Parametric Skinning & Contour Outlines
At each spine joint Pi, we calculate the local tangent vector ti and its orthogonal normal vector ni = (−ti,y, ti,x).
Parametric radius functions Wi dictate the creature's width profile:
Left Vertexi = Pi + ni × Wi | Right Vertexi = Pi − ni × Wi
Connecting left and right vertices with smooth cubic splines produces the organic body silhouette.
4. FABRIK Inverse Kinematics & Walking Gaits
For multi-jointed legs (Reptile, Spider, Centipede), we employ Forward And Backward Reaching Inverse Kinematics (FABRIK):
- Forward Reach: Place the end effector (foot) at target Pfoot and pull segments inward toward the body.
- Backward Reach: Anchor the root joint to the shoulder/hip offset Pshoulder and project segments outward.
- Gait Cycle & Velocity Lead: Foot triggers a step when distance from rest anchor exceeds Rstep. Landing target predicts forward body motion: Ptarget = Panchor + vcreature × Tlead.
- Parabolic Lift Arc: Foot lifts along a quadratic arc z(t) = 4 × Hlift × t × (1 − t) during swing phase.