Physics · interface
ControllerInput
Explained in Your first game, Rigid bodies.
interface ControllerInputimport type { ControllerInput } from '@driftengine/physics';Properties
| Name | Type | Description |
|---|---|---|
moveX | number | Desired direction, in world units per second. Length above maxSpeed is clamped. |
moveZ | number | |
moveYoptional | number | The third component, for a body whose up is not world Y. Absent means zero, which is what
every caller with a level floor means and is arithmetically what they got before this existed.MoreTwo components span the tangent plane only while up is world Y, and Read as a world direction and flattened onto the surface, exactly as the other two are. A caller supplying all three describes "forward" in whatever frame it is standing in. |
projectMoveoptional | boolean | Whether to flatten the move vector onto the plane the body is standing on. Absent means yes,
which is what every caller before this got and what a body moving on one surface wants.MoreFalse is for a body between two surfaces, which is the one case the projection cannot serve. Steering normally holds the along-up component out, steers the rest and puts it back, because that component is gravity and the jump rather than the stick. A body crossing a convex edge has a third thing there: while its frame rotates from the old face to the new, the correct direction of travel is neither face's tangent but a blend of them, held by the contacts already on the far side. Flattened onto the frame's current plane that command is turned aside — by 8.5 degrees early in a 90-degree crossing and more later — and the body crawls the transfer instead of crossing it. Measured from outside on a sprint across a 90-degree convex edge: contacts decaying from four to none by tick 46, slipping at 46, falling by 51, 21 ticks of 90 with nothing under it against none when the velocity was written directly. It is the projection and not the acceleration, which the reporter separated before asking:
the same crossing at acceleration times 15, 60, 240 and 2000 of With this false the move vector is the velocity the body is steered toward whole — the
along-up component included, because a caller that has taken responsibility for the direction
has taken responsibility for all of it. Everything else still applies: the speed clamp, the
acceleration and deceleration curves, |
jump | boolean | Held, not edge-triggered: the controller does its own edge detection and buffering. |