BasicSimulation class
Pure-Dart PhysicsSimulation suitable for picking, area triggers, and kinematic-only gameplay.
Supports scene queries and trigger events; does not simulate dynamics (no solver, no contact response, no joints). Dynamic bodies and joints throw UnsupportedError; for full rigid-body simulation use a backend package with a solver.
- Inheritance
-
- Object
- PhysicsSimulation
- BasicSimulation
Constructors
- BasicSimulation({Vector3? gravity})
Properties
- backendName → String
-
Identifier of the concrete backend, suitable for logging (for
example
"rapier3d").no setteroverride -
collisions
→ Stream<
SimCollisionEvent> -
Collision lifecycle events, keyed by collider handle.
no setteroverride
- fixedTimestep ↔ double
-
Length of one physics step, in seconds.
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
- maxSubsteps ↔ int
-
Maximum number of fixed steps consumed per frame by the driver.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportsCharacters → bool
-
no setterinherited
- supportsJoints → bool
-
no setteroverride
Methods
-
applyAngularImpulse(
int bodyHandle, Vector3 impulse) → void -
override
-
applyForce(
int bodyHandle, Vector3 force, {Vector3? atWorldPoint}) → void -
override
-
applyImpulse(
int bodyHandle, Vector3 impulse, {Vector3? atWorldPoint}) → void -
override
-
applyTorque(
int bodyHandle, Vector3 torque) → void -
override
-
createAnchorBody(
) → int -
Creates an invisible fixed body for anchoring world-space joints.
override
-
createBody(
{required PoseTarget target, required BodyType type, double? additionalMass}) → int -
Creates a body at
target's current pose and returns its handle. Dynamic bodies write their simulated pose back totargetduring interpolatePoses.override -
createColliders(
int bodyHandle, Shape shape, {PhysicsMaterial material = PhysicsMaterial.defaultMaterial, bool isTrigger = false, Matrix4? localPose, int collisionLayer = 0xFFFFFFFF, int collisionMask = 0xFFFFFFFF}) → List< int> -
Creates collision geometry on
bodyHandleand returns one handle per created collider (compound shapes may decompose; how is backend private). Empty means the shape is unsupported by this backend.override -
createJoint(
JointDesc desc) → int -
override
-
destroyAnchorBody(
int bodyHandle) → void -
override
-
destroyBody(
int bodyHandle) → void -
override
-
destroyCollider(
int colliderHandle) → void -
override
-
destroyJoint(
int jointHandle) → void -
override
-
dispose(
) → void -
Releases every body, collider, and joint. Called by owners when the
simulation is discarded.
override
-
interpolatePoses(
double alpha) → void -
Writes interpolated dynamic-body poses to their PoseTargets.
alphais the accumulator fraction in[0, 1],0the previous step,1the current step.override -
isBodySleeping(
int bodyHandle) → bool -
override
-
moveCharacter(
int colliderHandle, {required Vector3 position, required Vector3 desiredTranslation, double? deltaSeconds, Vector3? up, double offset = 0.01, bool slide = true, double maxSlopeClimbAngle = 0.7853981633974483, double minSlopeSlideAngle = 0.7853981633974483, double? snapToGround = 0.1, bool autostep = false, double autostepMaxHeight = 0.3, double autostepMinWidth = 0.1, bool autostepIncludeDynamicBodies = true, double characterMass = 0.0}) → CharacterMovement -
Kinematic character move-and-slide against
colliderHandle's surroundings. See the flutter_scene character controller for the parameter semantics.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overlapBox(
Vector3 center, Vector3 halfExtents, Quaternion rotation, {int layerMask = 0xFFFFFFFF, bool includeFixed = true, bool includeKinematic = true, bool includeDynamic = true, bool includeTriggers = false}) → List< SimOverlapHit> -
override
-
overlapSphere(
Vector3 center, double radius, {int layerMask = 0xFFFFFFFF, bool includeFixed = true, bool includeKinematic = true, bool includeDynamic = true, bool includeTriggers = false}) → List< SimOverlapHit> -
override
-
raycast(
Ray ray, {double maxDistance = double.infinity, int layerMask = 0xFFFFFFFF, bool includeFixed = true, bool includeKinematic = true, bool includeDynamic = true, bool includeTriggers = false}) → SimRaycastHit? -
override
-
raycastAll(
Ray ray, {double maxDistance = double.infinity, int layerMask = 0xFFFFFFFF, bool includeFixed = true, bool includeKinematic = true, bool includeDynamic = true, bool includeTriggers = false}) → List< SimRaycastHit> -
override
-
readBodyAngularVelocity(
int bodyHandle) → Vector3 -
override
-
readBodyLinearVelocity(
int bodyHandle) → Vector3 -
override
-
readBodyPose(
int bodyHandle) → (Vector3, Quaternion) -
override
-
setBodyAdditionalMass(
int bodyHandle, double mass) → void -
override
-
setBodyAngularDamping(
int bodyHandle, double damping) → void -
override
-
setBodyAngularVelocity(
int bodyHandle, Vector3 velocity) → void -
override
-
setBodyAxisLocks(
int bodyHandle, Vector3 linear, Vector3 angular) → void -
Per-axis motion factors in
[0, 1],1free,0locked.override -
setBodyCcdEnabled(
int bodyHandle, bool enabled) → void -
override
-
setBodyGravityScale(
int bodyHandle, double scale) → void -
override
-
setBodyKind(
int bodyHandle, BodyType type) → void -
override
-
setBodyKinematicTargetPose(
int bodyHandle, Vector3 translation, Quaternion rotation) → void -
Pushes the pose a kinematic body should reach by the next step.
override
-
setBodyLinearDamping(
int bodyHandle, double damping) → void -
override
-
setBodyLinearVelocity(
int bodyHandle, Vector3 velocity) → void -
override
-
setColliderFilter(
int colliderHandle, int layer, int mask) → void -
override
-
setColliderMaterial(
int colliderHandle, PhysicsMaterial material) → void -
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}) → SimShapeCastHit? -
override
-
sleepBody(
int bodyHandle) → void -
override
-
step(
double fixedDt) → void -
Advances the simulation by exactly
fixedDtseconds.override -
toString(
) → String -
A string representation of this object.
inherited
-
updateJoint(
int jointHandle, JointDesc desc) → void -
Reconfigures a joint in place. Backends without native updates may
destroy and recreate internally; the handle stays valid.
override
-
wakeBody(
int bodyHandle) → void -
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited