Every creature in Universe animates, but almost none of them move. The distinction matters: animation is a shader uniform feeding sin(uTime); movement is physics — velocity, heading, terrain contact, state transitions. Here is what each animal actually does right now.
sin(uTime * 0.8) * 0.015 scales the body mesh or SDF primitive. Every creature breathes. Nothing else is guaranteed.sin() animation. Sheep sway. Deer stand still. Songbirds perch then fly on a timer. Rabbits hop on a timer. No physics, no awareness, no terrain contact.shared/creature_physics.mjsThe physics library provides the substrate for creature movement. Six systems, composable per-creature.
| System | What it does | Key function | Cost |
|---|---|---|---|
| Ground following | Sample terrainH(x,z) each frame, set creature y to terrain height. Smooth with lerp to avoid popping. |
followTerrain(pos, terrainH) |
1 FBM sample/frame |
| Velocity locomotion | Integrate velocity: pos += vel * dt. Heading from atan2(vel.z, vel.x). Speed clamped per species. |
integrate(pos, vel, dt) |
3 adds + 1 atan2 |
| State machine | Finite states: idle, graze, walk, flee. Transitions on timers, proximity triggers, random chance. Each state sets target velocity. | updateState(creature, dt) |
branch + timer |
| Boids flocking | Separation, alignment, cohesion with spatial hashing for O(n) neighbor lookup. Hash grid cell size = separation radius. | flock(creatures, grid) |
O(n) with hash |
| Catmull-Rom splines | Smooth path through control points. Creatures follow spline with velocity proportional to arc length. Looping or one-shot. | followSpline(t, points) |
4 lerps per eval |
| 2-bone IK | Analytic IK solver for legs. Given hip position and foot target, compute knee angle via law of cosines. One acos call. |
solveIK2(hip, foot, L1, L2) |
1 acos + trig |
shared/creature_gait.mjsGaits are sine waves at different phases per leg. That is the entire insight. A walk is four sines 90° apart. A trot is two sines 180° apart. A gallop is four sines with asymmetric timing.
| Gait | Beats | Phase pattern | Foot timing | Body motion |
|---|---|---|---|---|
| Walk | 4-beat | LH, LF, RH, RF — 90° apart | sin(phase + i * π/2) |
Gentle lateral sway |
| Trot | 2-beat diagonal | LH+RF, RH+LF — 180° apart | sin(phase + i * π) |
Vertical bob, suspension |
| Canter | 3-beat | RH, LH+RF, LF — asymmetric | sin(phase + [0, 0.33, 0.33, 0.67] * 2π) |
Rolling pitch, lead change |
| Gallop | 4-beat rotary | RH, LH, RF, LF — rapid sequence | sin(phase + [0, 0.15, 0.5, 0.65] * 2π) |
Deep pitch, full suspension |
| Hop | 2-beat symmetric | Both rear, both front — in phase | sin(phase), sin(phase + π) |
Vertical launch, arc |
During swing phase, foot height follows a sinusoidal lift: y = liftHeight * sin(π * swingT). During stance phase, foot stays on ground. The swingT fraction (0→1 during swing) drives the entire animation.
sin(stridePhase * 2π) * bobAmplituded(speed)/dtbreathRate = baseRate + speed * 0.3Every creature physics operation decomposes into Lithos primitives. No new math is needed — the existing glyph table covers everything.
| Physics | Primitives | Ops |
|---|---|---|
| Ground following | terrainH ⇒ fbm2 (∼) |
~40 (FBM) |
| Heading | atan2 → ∼ ≃ |
~4 |
| Velocity | + position * velocity dt |
3 |
| Boids separation | - pos_i pos_j → diff, √ diff → dist, · diff / dist |
~8 per pair |
| IK (law of cosines) | ≃ (a²+b²-c²)/(2ab) — one cos¹ call |
~6 |
| Gait timing | ∼(phase × 2π) — sine at different phases |
1 per leg |
| State machine | Branch + compare — not math, just control flow | ~2 |
| Spatial hash | floor(pos / cellSize) — quantize to grid |
2 |
The most expensive operation is ground following (FBM = 6 octaves of noise = ~40 ops). Everything else is trivially cheap. The total per-creature per-frame cost is dominated by terrain sampling.
| Animal | Home | Moves | Follows terrain | Has gait | Flocks | State machine |
|---|---|---|---|---|---|---|
| Bull | Taurus | Breathes | No | No | No | No |
| Horses | Virgo | Elliptical path | No | Canter | No | No |
| Sheep | Virgo | Sway | No | No | No | No |
| Cave fish | Cenote | Swims | N/A | N/A | Separation | Freeze/swim |
| Rabbit | Virgo | Hops | No | Hop | No | Timer-based |
| Songbirds | Virgo | Perch/fly | No | No | No | Timer-based |
| Fish schools | Pisces | Lissajous | N/A | Tail wag | Pseudo | No |
| Deer | Virgo | Static | No | No | No | No |
| Swallows | Virgo | Lissajous flight | No | No | No | No |
The catalog shows the gap clearly: only cave fish have real behavior. Everything else is on rails or static. The physics and gait libraries exist to close this gap systematically.
sin(uTime). Some follow fixed curves (Lissajous, ellipse). No terrain contact, no awareness, no state. Cave fish are the exception — separation + freeze state.
creature_physics.mjs into each creature. Terrain sampling via terrainH. Velocity integration. State machines: idle → graze → walk → flee. Creatures touch the ground and respond to proximity.
creature_gait.mjs into each quadruped. 2-bone IK places feet on terrain. Gait phase drives leg animation. Body bob and pitch sync to stride. Horses walk, trot, canter. Sheep amble. Deer bound.
All creature movement is sine. This is not a simplification — it is the literal mathematical content. Every behavior in the creature system reduces to sin() at different frequencies, phases, and amplitudes.
sin(t * 0.8) * 0.015 — one sine, one creature, foreversin(phase + leg_i * offset) — same sine, different phase per leg. Walk = 4 sines. Trot = 2. Gallop = 4 with asymmetry.terrainH = fbm(p) = Σ sin(freq_i * p + phase_i) / amp_i — terrain IS sine. Following terrain IS following sine.sin(a*t), sin(b*t). Ellipse = cos(t), sin(t). Every path is a pair of sines.sin(stridePhase * 2π) * amplitude — the body rides a sine wave generated by its own feetsin(t * wagFreq) * wagAmp — a fish tail is a sine. A dog tail is a sine. Every tail is a sine.The Lithos glyph ∼ is not just a rendering primitive. It is the atom of life. Breathing is sine. Walking is sine. Flocking is sine. The entire creature physics system is a composition of ∼ at different scales.