physics library

The engine-agnostic physics contract.

The backend-driver interface (PhysicsSimulation), collision shapes, materials, joint descriptions, pose seam, queries, and the pure-Dart BasicSimulation. Physics engines (rapier, box3d, future backends) implement this; renderers and servers drive it. Pure Dart, optional, import it only when a build needs physics.

Classes

BasicSimulation Physics
Pure-Dart PhysicsSimulation suitable for picking, area triggers, and kinematic-only gameplay.
BoxShape Physics
An axis-aligned box of the given halfExtents centered at the collider's local origin.
CapsuleShape Physics
A capsule aligned with the local Y axis. halfHeight is the half length of the cylindrical section, excluding the hemispherical caps.
CharacterMovement Physics
Result of one kinematic character move-and-slide.
CompoundChild Physics
One child of a CompoundShape: a shape positioned by localPose relative to the compound's origin.
CompoundShape Physics
A union of children, each positioned by its own local pose.
ContactPoint Physics
One contact within a collision manifold.
ConvexHullShape Physics
The convex hull of points, stored as packed xyz triplets.
CylinderShape Physics
A cylinder aligned with the local Y axis. halfHeight is half the total height.
FixedJointDesc Physics
Welds the two bodies at their current relative pose.
GenericJointDesc Physics
A six-degree-of-freedom constraint with per-axis motion configs.
HeightFieldShape Physics
A row-major heightfield of width x depth samples, scaled by scale. Heights are sampled in the local XZ plane and offset along Y.
JointAxisConfig Physics
Motion allowance for one axis of a generic joint.
JointDesc Physics
Full description of a joint between two bodies.
JointMotor Physics
Drives a joint axis toward a target position and/or velocity.
PhysicsMaterial Physics
Surface properties (friction, restitution, density) of a collider.
PhysicsSimulation Physics
The backend driver contract, a physics engine addressed by integer handles, decoupled from any scene graph through PoseTargets.
PoseTarget Physics
Where a simulated body reads and writes its world pose.
PrismaticJointDesc Physics
A slider along localAxisA/localAxisB, optionally limited and motorized.
RayShapeHit Physics
Internal hit record. The owning world wraps this in a RaycastHit.
RevoluteJointDesc Physics
A hinge about localAxisA/localAxisB, optionally limited and motorized.
Shape Physics
Geometric description of a collider's volume.
SimCollisionBegan Physics
Contact between two colliders began this step, carrying its contacts.
SimCollisionEnded Physics
Contact between two colliders ended this step.
SimCollisionEvent Physics
Collision lifecycle events at the simulation level, keyed by collider handles. Engine layers resolve handles to their own collider objects.
SimOverlapHit Physics
An overlap result at the simulation level.
SimplePoseTarget Physics
A plain mutable pose.
SimRaycastHit Physics
A raycast result at the simulation level, keyed by collider handle.
SimShapeCastHit Physics
A shape-cast result at the simulation level.
SimTriggerEntered Physics
A collider entered a trigger volume this step.
SimTriggerExited Physics
A collider left a trigger volume this step.
SphereShape Physics
A sphere centered at the collider's local origin.
SphericalJointDesc Physics
A ball-and-socket constraint at the local anchors.
TriMeshShape Physics
A triangle mesh defined by vertices (packed xyz triplets) and indices (groups of three vertex indices forming one triangle each).

Enums

BodyType Physics
Simulation mode for a body.
CombineRule Physics
How a per-contact friction or restitution value is derived from the two participating materials.
JointAxis Physics
One of the six relative degrees of freedom a generic joint constrains.
JointAxisMotion Physics
How a single axis of a GenericJointDesc is constrained.
JointMotorModel Physics
How a joint motor's strength is interpreted.

Functions

aabbRaycast(Ray ray, Aabb3 box, double maxDistance) RayShapeHit? Physics
Raycast against an axis-aligned box, the conservative fallback used by sphere casts against inflated collider bounds.
rayHitsShape(Ray ray, Shape shape, Matrix4 worldXform, double maxDistance) RayShapeHit? Physics
Closest hit of ray against shape under worldXform, or null.
shapesOverlap(Shape a, Matrix4 ax, Shape b, Matrix4 bx) bool Physics
Whether two world-space shapes overlap. Sphere-sphere and sphere-OBB pairs use exact tests; every other pair falls back to a conservative AABB-vs-AABB test (no false negatives, occasional false positives at corners). Suitable for the trigger pair detector in BasicPhysicsWorld.
shapeWorldAabb(Shape shape, Matrix4 worldXform) → Aabb3 Physics
World-space AABB enclosing shape under worldXform.
sphereOverlapsAabb(Vector3 center, double radius, Aabb3 box) bool Physics
Whether the closed ball at center of radius overlaps the AABB box.
sphereOverlapsSphere(Vector3 center, double radius, Vector3 otherCenter, double otherRadius) bool Physics
Whether the closed ball at center of radius overlaps a sphere of otherRadius centered at otherCenter.