A dynamic physics body that responds to forces, impulses, and collisions. Access via the 'physics' submodule.
Experimental API:
The physics submodule is an experimental and new API that is highly susceptible to breaking changes in the future.
Inherits from Body.
A dynamic physics body that responds to forces, impulses, and collisions.
| Name | Description | Type |
|---|---|---|
linear_velocity | The linear velocity of the body. | Vec2 |
angular_velocity | The angular velocity of the body. | float |
linear_damping | The linear damping of the body. | float |
angular_damping | The angular damping of the body. | float |
fixed_rotation | Whether the body has fixed rotation. | bool |
is_bullet | Whether CCD is enabled for this body. | bool |
is_awake | Whether the body is currently awake and simulating. | bool |
mass | The mass of the body. | float |
wake() → Nonewake() → NoneManually wake the body from sleep.
apply_force(force: Vec2, point: Vec2, wake: bool = True) → Noneapply_force(force: Vec2, point: Vec2, wake: bool = True) → NoneApply a force to the body at a specific point.
Args
force : The force vector to apply.point : The point (in world coordinates) where the force is applied.wake : Whether to wake the body if it's sleeping. Defaults to True.apply_force_to_center(force: Vec2, wake: bool = True) → Noneapply_force_to_center(force: Vec2, wake: bool = True) → NoneApply a force to the center of mass of the body.
Args
force : The force vector to apply.wake : Whether to wake the body if it's sleeping. Defaults to True.apply_torque(torque: float, wake: bool = True) → Noneapply_torque(torque: float, wake: bool = True) → NoneApply a torque to the body.
Args
torque : The torque to apply.wake : Whether to wake the body if it's sleeping. Defaults to True.apply_linear_impulse(impulse: Vec2, point: Vec2, wake: bool = True) → Noneapply_linear_impulse(impulse: Vec2, point: Vec2, wake: bool = True) → NoneApply a linear impulse to the body at a specific point.
Args
impulse : The impulse vector to apply.point : The point (in world coordinates) where the impulse is applied.wake : Whether to wake the body if it's sleeping. Defaults to True.apply_linear_impulse_to_center(impulse: Vec2, wake: bool = True) → Noneapply_linear_impulse_to_center(impulse: Vec2, wake: bool = True) → NoneApply a linear impulse to the center of mass of the body.
Args
impulse : The impulse vector to apply.wake : Whether to wake the body if it's sleeping. Defaults to True.apply_angular_impulse(impulse: float, wake: bool = True) → Noneapply_angular_impulse(impulse: float, wake: bool = True) → NoneApply an angular impulse to the body.
Args
impulse : The angular impulse to apply.wake : Whether to wake the body if it's sleeping. Defaults to True.