FakePhysicsEngine3D class final

A PhysicsEngine3D for tests, in plain Dart.

Every shape is its axis-aligned bounding box (a turned shape, the box round it) and the simulation turns nothing: dynamic bodies fall, land on and slide off other bodies, sensors report what enters them, rays and sweeps hit boxes, and a character walks on boxes, climbs steps, is stopped by walls and ceilings, and rides what it stands on. Joints are recorded, not simulated. It keeps Jolt's rules: which pairs touch (one body dynamic, or a kinematic body and a sensor), which shapes a body may have, what dead handles do. Deterministic: the same calls give the same results.

Pass unavailableReason to stand in for an engine that cannot run.

Implemented types

Constructors

FakePhysicsEngine3D({String? unavailableReason, bool collisions = true})
A fake engine; unavailable, giving unavailableReason, when that is not null.

Properties

collisions → bool
Whether worlds it makes resolve collisions (off: bodies only move by velocity and gravity, for timing the ECS side).
final
destroyAllCalls ↔ int
How often destroyAll was called.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
name → String
A short name for logs: jolt, fake.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
unavailableReason → String?
Why this engine cannot run here (the web, a native library not in the build), or null when it can.
final
worlds → List<FakePhysicsWorld3D>
The worlds it made that are not disposed.
final

Methods

createWorld(PhysicsWorldSettings3D settings) → PhysicsWorld3D
Makes a world. Throws a Physics3DUnsupportedError saying why when unavailableReason is not null.
override
destroyAll() → void
Destroys every world this engine made in this process, whoever made it — for a hot restart, when the Dart objects that owned them are gone but native memory is not. A world still held reads as disposed.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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