Body

new Body()

Body component for physics simulation. Handles velocity, gravity, and grounded state.

Extends

Members

(readonly) properties

The entity that this component is attached to.

Inherited From

Methods

applyForce(x, y)

Apply a force to the body.

Parameters:
NameTypeDescription
xnumber
ynumber

applyKnockback()

Apply immediate knockback velocity, replacing the current velocity.

deserialize(props)

Populates the component properties from a data object. Override this method for custom property handling.

Parameters:
NameTypeDescription
propsobject

The properties object (usually from JSON).

Inherited From

impulse(x, y)

Apply an impulse (instant velocity change).

Parameters:
NameTypeDescription
xnumber
ynumber

update(deltaTime)

Update physics.

Parameters:
NameTypeDescription
deltaTimenumber

Time in seconds.