RigidBody
API reference for RigidBody. Access via the 'physics' submodule.
Experimental API:
The physics submodule is a VERY experimental and new API that is highly susceptible to breaking changes in the future.
Inherits from Body.
Constructor
Properties
| Name | Description | Type |
|---|---|---|
angular_damping | The angular damping of the body. | float |
angular_velocity | The angular velocity of the body. | float |
fixed_rotation | Whether the body has fixed rotation. | bool |
is_awake | Whether the body is currently awake and simulating. | bool |
is_bullet | Whether CCD is enabled for this body. | bool |
linear_damping | The linear damping of the body. | float |
linear_velocity | The linear velocity of the body. | Vec2 |
mass | The mass of the body. | float |
Methods
Apply Angular Impulse
apply_angular_impulse(impulse: SupportsFloat, 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.
Apply Force
Apply 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
apply_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 Linear Impulse
Apply 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
apply_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 Torque
apply_torque(torque: SupportsFloat, 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.
Wake
wake() → NoneManually wake the body from sleep.