Remove the one-way platform PreListener and detach from space.
Update the down direction from raw components (normalized internally).
Set the character body's velocity. Call this each frame before
space.step().
Horizontal velocity (px/s). Set to 0 for no horizontal input.
Vertical velocity (px/s). Typically includes gravity accumulation.
Query the character's state after space.step() has run.
Detects ground, walls, slope angle, moving platforms, etc.
Call this each frame after space.step().
Velocity-based character controller for 2D platformers.
The character uses a dynamic body whose velocity is set each frame. Collision response (including one-way platforms) is handled entirely by the physics engine via
space.step()andPreListenercallbacks — matching the original nape Haxe engine pattern.The controller provides:
setVelocity)timeSinceGrounded)Example