Body describes all the physical properties pos, vel, acc, rotation, angular velocity for the purpose of of physics simulation.





__oldTransformCaptured: boolean = false

Indicates whether the old transform has been captured at least once for interpolation

bounciness: number = 0.2

The also known as coefficient of restitution of this actor, represents the amount of energy preserved after collision or the bounciness. If 1, it is 100% bouncy, 0 it completely absorbs.

canSleep: boolean = Physics.bodiesCanSleepByDefault

Can this body sleep, by default bodies do not sleep

collisionType: CollisionType = CollisionType.PreventCollision

Collision type for the rigidbody physics simulation, by default CollisionType.PreventCollision

dependencies: (typeof TransformComponent | typeof MotionComponent)[] = ...

Optionally list any component types this component depends on If the owner entity does not have these components, new components will be added to the entity

Only components with zero-arg constructors are supported as automatic component dependencies

enableFixedUpdateInterpolate: boolean = true

Enable or disabled the fixed update interpolation, by default interpolation is on.

events: EventDispatcher<any> = ...
friction: number = 0.99

The coefficient of friction on this actor

group: CollisionGroup = CollisionGroup.All

The collision group for the body's colliders, by default body colliders collide with everything

id: Id<"body"> = ...
limitDegreeOfFreedom: DegreeOfFreedom[] = []

Degrees of freedom to limit

Note: this only limits responses in the realistic solver, if velocity/angularVelocity is set the actor will still respond

oldAcc: Vector = Vector.Zero

Gets/sets the acceleration of the actor from the last frame. This does not include the global acc Physics.acc.

oldVel: Vector = ...

The velocity of the actor last frame (vx, vy) in pixels/second

optional?: ComponentCtor<Component<string>>[]
owner?: Entity = null

Current owning Entity, if any, of this component. Null if not added to any Entity

sleepMotion: number = ...

Amount of "motion" the body has before sleeping. If below Physics.sleepEpsilon it goes to "sleep"

type: "ex.body" = 'ex.body'

Type of this component, must be a unique type among component types in you game.

useGravity: boolean = true

Should use global gravity Physics.gravity in it's physics simulation, default is true

_ID: number = 0



  • Set the sleep state of the body


    • sleeping: boolean

    Returns void