BasicPhysicsWorld class Physics
Pure-Dart PhysicsWorld suitable for picking, area triggers, and kinematic-only gameplay.
Supports scene queries (raycast, raycastAll, overlapSphere, overlapBox, shapeCast) and trigger events. Does not simulate dynamics (no constraint solver, no contact response). Construct BasicColliders for geometry the queries should see, and attach BasicKinematicBodys to nodes you intend to move under your own control. For full rigid-body simulation, depend on a backend package with a solver.
- Inheritance
-
- Object
- Component
- PhysicsWorld
- BasicPhysicsWorld
Constructors
- BasicPhysicsWorld({Vector3? gravity})
Properties
- backendName → String
-
Identifier of the concrete backend, suitable for logging
(for example
"basic").no setteroverride -
collisions
→ Stream<
CollisionEvent> -
Stream of collision lifecycle events for every body in this world.
no setteroverride
- enabled ↔ bool
-
Whether this component's update hook runs each frame.
getter/setter pairinherited
- fixedTimestep ↔ double
-
Length of one physics step, in seconds. Defaults to
1/60.getter/setter pairinherited - gravity ↔ Vector3
-
World-space acceleration applied to every dynamic body each step.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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
- maxSubsteps ↔ int
-
Maximum number of fixed steps consumed per frame. When the frame
interval falls behind this many steps, remaining accumulated time
is dropped to keep simulation from spiralling.
getter/setter pairinherited
- node → Node
-
The node this component is attached to.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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.inherited -
interpolateTransforms(
double alpha) → void - Interpolates dynamic-body node transforms between the previous and current physics steps for smooth rendering when the frame rate is not a multiple of the physics rate.
-
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.
override
-
overlapBox(
Vector3 center, Vector3 halfExtents, Quaternion rotation, {int layerMask = 0xFFFFFFFF, bool includeFixed = true, bool includeKinematic = true, bool includeDynamic = true, bool includeTriggers = false}) → List< OverlapHit> -
override
-
overlapSphere(
Vector3 center, double radius, {int layerMask = 0xFFFFFFFF, bool includeFixed = true, bool includeKinematic = true, bool includeDynamic = true, bool includeTriggers = false}) → List< OverlapHit> -
override
-
raycast(
Ray ray, {double maxDistance = double.infinity, int layerMask = 0xFFFFFFFF, bool includeFixed = true, bool includeKinematic = true, bool includeDynamic = true, bool includeTriggers = false}) → RaycastHit? -
override
-
raycastAll(
Ray ray, {double maxDistance = double.infinity, int layerMask = 0xFFFFFFFF, bool includeFixed = true, bool includeKinematic = true, bool includeDynamic = true, bool includeTriggers = false}) → List< RaycastHit> -
override
-
shapeCast(
Shape shape, Matrix4 from, Vector3 direction, double distance, {int layerMask = 0xFFFFFFFF, bool includeFixed = true, bool includeKinematic = true, bool includeDynamic = true, bool includeTriggers = false}) → ShapeCastHit? -
override
-
step(
double fixedDt) → void -
Advances the simulation by exactly
fixedDtseconds. -
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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited