new Body()
Body component for physics simulation. Handles velocity, gravity, and grounded state.
- Source
Extends
Members
(readonly) properties
The entity that this component is attached to.
- Inherited From
- Source
Methods
applyForce(x, y)
Apply a force to the body.
Parameters:
| Name | Type | Description |
|---|---|---|
x | number | |
y | number |
- Source
applyKnockback()
Apply immediate knockback velocity, replacing the current velocity.
- Source
deserialize(props)
Populates the component properties from a data object. Override this method for custom property handling.
Parameters:
| Name | Type | Description |
|---|---|---|
props | object | The properties object (usually from JSON). |
- Inherited From
- Source
impulse(x, y)
Apply an impulse (instant velocity change).
Parameters:
| Name | Type | Description |
|---|---|---|
x | number | |
y | number |
- Source
update(deltaTime)
Update physics.
Parameters:
| Name | Type | Description |
|---|---|---|
deltaTime | number | Time in seconds. |
- Source