physics_3d library
just_physics_engine's 3-D side on its own: PhysicsEngine3D (made by
PhysicsEngineFactory.create3D, Jolt Physics through just_jolt), the
PhysicsWorld3D it makes, and the plain data both speak — shapes,
settings, poses, hits and events — with the math types they use.
Units are metres, seconds and radians; +Y is down, so gravity is (0, +9.81, 0).
Classes
- BodyPoses3D
- Bodies' poses after a step, packed stride floats each: position (3), rotation quaternion x y z w (4), linear velocity (3), angular velocity (3), awake (1 or 0).
- BodySettings3D
- Everything about a new body but its shape.
- BoxShape3D
- A box of half extents hx, hy, hz about its centre.
- CapsuleShape3D
- A capsule along Y about its centre: a cylinder halfHeight each way with a hemisphere of radius on each end.
- CharacterContact3D
- Something a character touches.
- CharacterSettings3D
- How a character is made: a capsule standing on its position.
- CharacterState3D
- A character after a step. A world refills one it is given.
- CompoundShape3D
- Several shapes as one: a staircase of boxes, an arch of hulls. Each part is placed in its body's space — a TransformedShape3D for one that is not at the body's origin. Any body type may have one, a dynamic body included, so a concave thing made of convex parts can tumble.
- ConvexHullShape3D
- The convex hull of points (x, y, z each).
- CylinderShape3D
- A cylinder along Y about its centre.
- HeightFieldShape3D
- Terrain: a square grid of heights. Static bodies only.
- JointSettings3D
- How a joint is made. Points and axes are in world space, as the bodies are when it is made.
- JoltPhysicsEngine
- Jolt Physics (through just_jolt) as a PhysicsEngine3D.
- MeshShape3D
- A triangle mesh: three indices per triangle into positions. Static bodies only: a body that moves needs a convex shape, or a CompoundShape3D of them.
- PhysicsEngine3D
- A 3-D physics engine: makes PhysicsWorld3Ds.
- PhysicsEngineFactory
- The platform's physics engines.
- PhysicsEvent3D
- One event from a step. Begin and stay events carry a contact point, the normal pointing from bodyA to bodyB (zero for sensors) and how deep they overlap.
- PhysicsWorld3D
- One simulation: bodies, joints and characters that see each other.
- PhysicsWorldSettings3D
- How a world is made.
- Quaternion
-
A mutable rotation quaternion
(x, y, z, w), Hamilton convention. - QueryFilter3D
- What a query looks at.
- QueryHit3D
- A query's hit.
- Shape3D
- The shape of a body, a query or a character, as plain data a backend turns into its own.
- SphereShape3D
- A sphere of radius about its centre.
- TransformedShape3D
- shape moved by (x, y, z) and turned by the unit quaternion (qx, qy, qz, qw) in its body's space: a collider's offset.
- Vector3
- A mutable 3-D vector.
Enums
- BodyType3D
- How a body moves.
- GroundState3D
- Whether a character stands on something.
- JointKind3D
- The kind of a joint.
- MotionQuality3D
- How carefully a moving body checks for collisions.
- MotorState3D
- What drives a hinge or slider.
- PhysicsEventType3D
- What happened between bodies during a step.
- SixDofAxisMode3D
- What a six-degrees-of-freedom joint lets one axis do.
Exceptions / Errors
- Physics3DUnsupportedError
-
3-D physics cannot run here: the web (no
dart:ffi), a 32-bit Android ABI, or an app that did not ask for Jolt to be built. message says which, and what to change when something can be.