Skip to content

RigidBodyComponent

RigidBodyComponent

acceleration property writable

acceleration: Vector2

Net acceleration applied every physics step, in addition to any per-frame add_force() calls

angular_acceleration property writable

angular_acceleration: float

Angular acceleration in radians per second squared, applied every physics step

angular_damping property writable

angular_damping: float

Fraction of angular velocity lost per second (0 = none, 1 = stops immediately)

angular_velocity property writable

angular_velocity: float

Angular velocity in radians per second

enable property writable

enable: bool

Whether this component is active

inertia property writable

inertia: float

Rotational inertia. Setting this directly overrides whatever recalculate_inertia()/mass changes would otherwise compute.

inverse_inertia property writable

inverse_inertia: float

1/inertia. Set this to 0 to prevent rotation entirely.

inverse_mass property writable

inverse_mass: float

1/mass. Set this to 0 to make the body immovable/infinite mass. Setting this also recalculates inertia from the current shape.

linear_damping property writable

linear_damping: float

Fraction of linear velocity lost per second (0 = none, 1 = stops immediately)

mass property writable

mass: float

Mass of the body. Values <= 0 are clamped to 0.001. Setting this also recalculates inertia from the current shape.

net_force property writable

net_force: Vector2

Read-back of the total force accumulated this step, for inspection/debugging. Use add_force() to actually apply forces.

owner property

owner: Object

The Object that owns this component

torque property writable

torque: float

Read-back of the total torque accumulated this step, for inspection/debugging

velocity property writable

velocity: Vector3

Linear velocity in world units per second

add_child

add_child(obj: Object) -> Object

Add obj as a child of this component's owning Object

add_component

add_component(component_class: Any) -> typing.Any

Attach a new component of the given type to this component's owning Object.

Example
render = self.add_component(RenderComponent)

add_force

add_force(force: Vector3) -> None

Apply a force through the center of mass

add_force_at_local_point

add_force_at_local_point(force: Vector3, point: Vector3) -> None

Apply a force at a point given in this object's local/model coordinates

add_force_at_world_point

add_force_at_world_point(force: Vector3, point: Vector3) -> None

Apply a force at a point given in world coordinates

add_object

add_object(obj: Object, parent: Object = None) -> Object

Add a newly created Object to the scene, optionally parented to another Object

get_component

get_component(component_class: Any) -> typing.Any

Look up a component on this Object

get_owner

get_owner() -> Object

The Object that owns this component

has_component

has_component(component_class: Any) -> bool

Check whether this component's owning Object has a component of the given type

recalculate_inertia

recalculate_inertia() -> None

Recompute inertia from the current shape and mass, e.g. after resizing

remove_component

remove_component(component_class: Any) -> None

Remove a component of the given type from this component's owning Object

remove_object

remove_object(obj: Object) -> None

Remove an object from the scene

set_acceleration

set_acceleration(acceleration: Vector2) -> None

Set acceleration. See the acceleration property.

set_angular_acceleration

set_angular_acceleration(angular_acceleration: SupportsFloat | SupportsIndex) -> None

Set angular_acceleration. See the angular_acceleration property.

set_angular_damping

set_angular_damping(angular_damping: SupportsFloat | SupportsIndex) -> None

Set angular_damping. See the angular_damping property.

set_angular_velocity

set_angular_velocity(angular_velocity: SupportsFloat | SupportsIndex) -> None

Set angular_velocity. See the angular_velocity property.

set_enable

set_enable(arg0: bool) -> None

Set enable. See the enable property.

set_inertia

set_inertia(inertia: SupportsFloat | SupportsIndex) -> None

Set inertia. See the inertia property.

set_inverse_inertia

set_inverse_inertia(inverse_inertia: SupportsFloat | SupportsIndex) -> None

Set inverse_inertia. See the inverse_inertia property.

set_inverse_mass

set_inverse_mass(inverse_mass: SupportsFloat | SupportsIndex) -> None

Set inverse_mass. See the inverse_mass property.

set_linear_damping

set_linear_damping(linear_damping: SupportsFloat | SupportsIndex) -> None

Set linear_damping. See the linear_damping property.

set_mass

set_mass(mass: SupportsFloat | SupportsIndex) -> None

Set mass. See the mass property.

set_net_force

set_net_force(net_force: Vector2) -> None

Set net_force. See the net_force property.

set_torque

set_torque(torque: SupportsFloat | SupportsIndex) -> None

Set torque. See the torque property.

set_velocity

set_velocity(velocity: Vector3) -> None

Set velocity. See the velocity property.