RigidBody class Physics
A simulated rigid body attached to a Node.
One rigid body per node; Colliders on the same node define its collision volume. Registers with the nearest ancestor PhysicsWorld on mount. Transform sync direction depends on type (see sim.BodyType); mutating a dynamic body's node transform is treated as a teleport.
Constructors
Properties
- angularAxisLocks ↔ Vector3
-
Per-axis angular motion factors. See linearAxisLocks.
getter/setter pair
- angularDamping ↔ double
-
Per-step angular velocity damping in
[0, 1].0is no damping.getter/setter pair - angularVelocity ↔ Vector3
-
getter/setter pair
- ccdEnabled ↔ bool
-
Continuous collision detection, prevents fast bodies from tunneling
through thin colliders.
getter/setter pair
- enabled ↔ bool
-
Whether this component's update hook runs each frame.
getter/setter pairinherited
- handle → int?
-
The body's simulation handle, or null while unmounted.
no setter
- 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 in
[0, 1],1free,0locked.getter/setter pair - linearDamping ↔ double
-
Per-step linear velocity damping in
[0, 1].0is 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
-
Changes the simulation mode in place (an elevator switching between
kinematic and fixed, a prop becoming dynamic on release).
getter/setter pair
- useGravity ↔ bool
-
getter/setter pair
- world → PhysicsWorld?
-
The owning world while mounted.
no setter
Methods
-
applyAngularImpulse(
Vector3 impulse) → void -
applyForce(
Vector3 force, {Vector3? atWorldPoint}) → void -
Applies a continuous
force(world space) for the current step;atWorldPointmakes it produce torque about the center of mass. -
applyImpulse(
Vector3 impulse, {Vector3? atWorldPoint}) → void -
applyTorque(
Vector3 torque) → void -
cloneFor(
Node cloneOwner) → Component? -
Returns a copy of this component for
cloneOwner, the Node.clone counterpart of the owning node, or null to not carry the component to clones (the default).inherited -
fixedUpdate(
double fixedDt) → void -
Called once per fixed physics step while the component is mounted,
enabled, and loaded.
fixedDtis the fixed timestep of the surrounding PhysicsWorld, not the frame interval.override -
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.
override
-
onUnmount(
) → void -
Called when the owning node leaves a live scene graph.
override
-
putToSleep(
) → void -
readSimulationPose(
) → (Vector3, Quaternion) - The body's pose fresh from the simulation, unlike the node transform this is exact mid-step state (useful inside fixedUpdate, where the interpolated node transform lags).
-
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.
deltaSecondsis the elapsed time since the previous tick.inherited -
wakeUp(
) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited