The body component.
group
Component Types
Object current velocity.
since
v3001.0
How much velocity decays (velocity *= (1 - drag) every frame).
since
v3001.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).
since
v3000.0
If object should move with moving platform (default true).
since
v3000.0
Current platform landing on.
If currently landing on a platform.
since
v2000.1
If currently falling.
since
v2000.1
If currently rising.
since
v3000.0
Applies an impulse
param
impulseThe impulse vector, applied directly
addForce(force: Vec2): void
Applies a force
param
forceThe 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.
since
v3000.0
onBeforePhysicsResolve(action: (col: Collision)=>void): KEventController
Register an event that runs before a collision would be resolved.
since
v3000.0
onGround(action: ()=>void): KEventController
Register an event that runs when the object is grounded.
since
v2000.1
onFall(action: ()=>void): KEventController
Register an event that runs when the object starts falling.
since
v2000.1
onFallOff(action: ()=>void): KEventController
Register an event that runs when the object falls off platform.
since
v3000.0
onHeadbutt(action: ()=>void): KEventController
Register an event that runs when the object bumps into something on the head.
since
v2000.1
onLand(action: (obj: GameObj)=>void): KEventController
Register an event that runs when an object lands on this object.
since
v3001.0
onHeadbutted(action: (obj: GameObj)=>void): KEventController
Register an event that runs when the object is bumped by another object head.