Skip to main content

RigidBody3D

Inherits: PhysicsBody3D < CollisionObject3D < Node3D < Node < Object

Description

A 3D physics body that is moved by a physics simulation. RigidBody3D implements full 3D physics. It cannot be controlled directly; instead, you must apply forces to it.

Properties

mass
float
default:"1.0"
The body’s mass.
linear_velocity
Vector3
default:"Vector3(0, 0, 0)"
The body’s linear velocity.
angular_velocity
Vector3
default:"Vector3(0, 0, 0)"
The RigidBody3D’s rotational velocity in radians per second.
gravity_scale
float
default:"1.0"
Multiplies the gravity applied to the body.
freeze
bool
default:"false"
If true, the body is frozen. Gravity and forces are not applied.

Methods

apply_central_impulse

void apply_central_impulse(impulse: Vector3)
Applies a directional impulse without affecting rotation.

apply_impulse

void apply_impulse(impulse: Vector3, position: Vector3 = Vector3(0, 0, 0))
Applies a positioned impulse to the body.

apply_force

void apply_force(force: Vector3, position: Vector3 = Vector3(0, 0, 0))
Applies a positioned force to the body.

apply_torque

void apply_torque(torque: Vector3)
Applies a rotational force without affecting position.

Signals

body_entered(body: Node)

Emitted when a body enters into contact with this one.

body_exited(body: Node)

Emitted when a body exits contact with this one.

Example Usage

extends RigidBody3D

func _ready():
    mass = 5.0
    gravity_scale = 2.0

func explode():
    # Apply explosion force upward
    apply_central_impulse(Vector3(0, 1000, 0))

func push_forward():
    # Apply force in forward direction
    var forward = -global_transform.basis.z
    apply_force(forward * 500)

Build docs developers (and LLMs) love