The body component.
groupComponent Types
Object current velocity.
sincev3001.0
How much velocity decays (velocity *= (1 - drag) every frame).
sincev3001.0
If object is static, it won't move, all non static objects won't move past it, and all
calls to addForce(), applyImpulse(), or jump() on this body will do absolutely nothing.
Initial speed in pixels per second for jump().
Gravity multiplier.
Mass of the body, decides how much a non-static body should move when resolves with another non-static body. (default 1).
sincev3000.0
If object should move with moving platform (default true).
sincev3000.0
Current platform landing on.
If currently landing on a platform.
sincev2000.1
If currently falling.
sincev2000.1
If currently rising.
sincev3000.0
Applies an impulse
paramimpulseThe impulse vector, applied directly
addForce(force: Vec2): void
Applies a force
paramforceThe force vector, applied after scaled by the inverse mass
jump(force?: number): void
Upward thrust.
onPhysicsResolve(action: (col: Collision)=>void): KEventController
Register an event that runs when a collision is resolved.
sincev3000.0
onBeforePhysicsResolve(action: (col: Collision)=>void): KEventController
Register an event that runs before a collision would be resolved.
sincev3000.0
onGround(action: ()=>void): KEventController
Register an event that runs when the object is grounded.
sincev2000.1
onFall(action: ()=>void): KEventController
Register an event that runs when the object starts falling.
sincev2000.1
onFallOff(action: ()=>void): KEventController
Register an event that runs when the object falls off platform.
sincev3000.0
onHeadbutt(action: ()=>void): KEventController
Register an event that runs when the object bumps into something on the head.
sincev2000.1
onLand(action: (obj: GameObj)=>void): KEventController
Register an event that runs when an object lands on this object.
sincev3001.0
onHeadbutted(action: (obj: GameObj)=>void): KEventController
Register an event that runs when the object is bumped by another object head.