Skip to main content

Module character

Module character 

Source
Expand description

Character controller (stage CC) — a walking body over the scene; see docs/porting/PORTING-CONTROLLER.md. Character controller (stage CC.1 — see docs/porting/PORTING-CONTROLLER.md).

A walking body over a Scene: substepped per-axis move-and-slide against the crate::collide probe, gravity, jumping, ground / head-bump detection — and swimming (stage WT.1): a Walk-mode body submerged past CharacterDef::swim_enter_frac of its height in a crate::WaterVolume enters the swim state automatically (buoyancy, vertical drag, jump strokes up / sink strokes down, a jump with the head above water breaches). Not to be confused with .rkc characters (roxlap-formats’ animated-model container) — this is what you stand on the ground with; a .rkc character is what you draw (CC.4 connects the two).

Conventions (get the signs wrong and everything compiles and “works” upside down): +z is DOWN, so gravity is positive z, a jump impulse is negative z, the body’s feet are its largest-z end and its head is at feet.z - height. Positions and velocities are f64 world space, matching the camera and crate::GridTransform.

Movement is deterministic — pure f64, no RNG, a fixed substep rule — so trajectories are unit-testable: same scene + same input sequence = identical path.

Structs§

CharacterBody
A walking body: feet-positioned collision box + velocity + contact flags. Construct with CharacterBody::new, place with teleport, then call walk once per frame.
CharacterDef
Construction-time parameters of a CharacterBody. Distances in voxels (= world units), times in seconds.
WalkInput
Per-frame input to CharacterBody::walk.

Enums§

MoveMode
How CharacterBody::walk moves the body.