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


NameDescriptionType
angular_dampingThe angular damping of the body.float
angular_velocityThe angular velocity of the body.float
fixed_rotationWhether the body has fixed rotation.bool
is_awakeWhether the body is currently awake and simulating.bool
is_bulletWhether CCD is enabled for this body.bool
linear_dampingThe linear damping of the body.float
linear_velocityThe linear velocity of the body.Vec2
massThe mass of the body.float

Methods


Apply Angular Impulse

apply_angular_impulse(impulse: SupportsFloat, wake: bool = True) None

Apply 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_force(
    force: Vec2,
    point: Vec2,
    wake: bool = True
) None

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) None

Apply 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_linear_impulse(
    impulse: Vec2,
    point: Vec2,
    wake: bool = True
) None

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) None

Apply 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) None

Apply 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() None

Manually wake the body from sleep.