RigidBody class abstract Physics

A simulated rigid body attached to a Node.

One rigid body per node. Colliders attached to the same node (or to descendant nodes, depending on the backend) define its collision volume.

Transform sync direction depends on type: see BodyType. Mutating a BodyType.dynamic_ body's Node.localTransform is allowed but is treated as a teleport (the backend overrides velocity and wakes the body).

Inheritance
Implementers

Constructors

RigidBody()

Properties

angularAxisLocks ↔ Vector3
Per-axis angular motion factors. See linearAxisLocks.
getter/setter pair
angularDamping double
Per-step angular velocity damping in [0, 1]. 0 is no damping.
getter/setter pair
angularVelocity ↔ Vector3
getter/setter pair
ccdEnabled bool
When true, the backend uses continuous collision detection to prevent fast-moving bodies from tunneling through thin colliders.
getter/setter pair
enabled bool
Whether this component's update hook runs each frame.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
inertiaTensor ↔ Matrix3?
Local-space inertia tensor. When null, derived from the owning colliders.
getter/setter pair
isAttached bool
Whether this component is currently attached to a node.
no setterinherited
isLoaded bool
Whether onLoad has completed.
no setterinherited
isMounted bool
Whether the owning node is part of a live scene graph.
no setterinherited
isSleeping bool
no setter
linearAxisLocks ↔ Vector3
Per-axis linear motion factors. Each component is in [0, 1]: 1 leaves the axis free, 0 locks it. Use to constrain motion to a plane (for example (1, 1, 0) for 2D-style motion in XY).
getter/setter pair
linearDamping double
Per-step linear velocity damping in [0, 1]. 0 is no damping.
getter/setter pair
linearVelocity ↔ Vector3
getter/setter pair
mass double?
Mass in kilograms. When null, the backend derives mass from the owning colliders' shapes and material densities.
getter/setter pair
node Node
The node this component is attached to.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type BodyType
no setter
useGravity bool
getter/setter pair

Methods

applyAngularImpulse(Vector3 impulse) → void
applyForce(Vector3 force, {Vector3? atWorldPoint}) → void
Applies a continuous force (in world space) for the duration of the current step. Use applyImpulse for an instantaneous change in momentum. When atWorldPoint is provided, the force produces a torque about the body's center of mass.
applyImpulse(Vector3 impulse, {Vector3? atWorldPoint}) → void
applyTorque(Vector3 torque) → void
fixedUpdate(double fixedDt) → void
Called once per fixed physics step while the component is mounted, enabled, and loaded. fixedDt is the fixed timestep of the surrounding PhysicsWorld, not the frame interval.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAttach() → void
Called when this component is added to a node.
inherited
onDetach() → void
Called when this component is removed from a node.
inherited
onLoad() Future<void>
Optional asynchronous setup, such as loading an asset.
inherited
onMount() → void
Called when the owning node enters a live scene graph.
inherited
onUnmount() → void
Called when the owning node leaves a live scene graph.
inherited
putToSleep() → void
toString() String
A string representation of this object.
inherited
update(double deltaSeconds) → void
Called once per frame while the component is mounted, enabled, and loaded. deltaSeconds is the elapsed time since the previous tick.
inherited
wakeUp() → void

Operators

operator ==(Object other) bool
The equality operator.
inherited