physics_3d library

3-D physics for just_game_engine.

Units are metres; +Y is down, so gravity is (0, +9.81, 0).

Classes

AssetColliderGeometry3D
Triangles from the engine's loaded ModelAssets. A model not loaded yet is loaded through assets (a renderer such as just_graphics_engine registers the loader for AssetType.model).
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.
CameraCollision3D
Keeps a virtual camera out of walls: on the same entity as an OrbitFollowComponent (or any body stage), it pulls the camera in towards its target when something solid is between them, and eases it back out once the way is clear.
CameraCollisionStage
Finalizes a CameraCollision3D camera: a sphere cast from the point the camera circles to where the body stage put it, the target's own body ignored. Registered by Physics3D.
CapsuleShape3D
A capsule along Y about its centre: a cylinder halfHeight each way with a hemisphere of radius on each end.
CharacterBody3D
A character controlled by gameplay rather than forces: a capsule that walks on ground, slides along walls, climbs steps and slopes, and rides moving platforms (Jolt's CharacterVirtual). Its entity's position is its feet.
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.
Collider3D
The shape of its entity's RigidBody3D — or, without one, of a static body made for it. It follows the entity's scale. Set to ColliderShape3D.matchShape it takes the shape its entity is drawn as.
ColliderGeometry3D
Where mesh and convex-hull colliders get their triangles.
ColliderShapes3D
Turns Collider3Ds into physics-engine Shape3Ds, following the entity's scale. Mesh and hull shapes are kept by model, mesh and scale, height fields by their heights and scale, and shapes matching an entity's look by that look's key and scale, so every body asking for the same one gets the same lists — and the physics engine shares one native shape between them. Each kind keeps its most recently used few (modelLimit, fieldLimit, solidLimit); a shape dropped is made again when next asked for.
CollisionEnter3DEvent
Two entities' bodies started touching. Fired on the world's event bus by PhysicsSystem3D after the step:
CollisionExit3DEvent
Two entities' bodies stopped touching.
CollisionStay3DEvent
Two entities' bodies are still touching after a step. Only fired when the service was made with reportContactStay: true.
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.
DistanceJoint3D
Keeps two anchors within a distance range: a rope, a chain link, a spring.
FixedJoint3D
Holds two bodies rigidly together.
HeightFieldShape3D
Terrain: a square grid of heights. Static bodies only.
HingeJoint3D
Lets two bodies turn about one axis: a door, a wheel, a lever.
Joint3D
What a joint holds its entity's body to. The joint is on one entity (A) and names the other (connectedBody, B); none joins A to the world.
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.
Physics3D
3-D physics for an engine. Give one to the engine and its 3-D physics components — RigidBody3D, Collider3D, CharacterBody3D and the joints — are saved, loaded, offered in the editor's 3-D scenes and simulated:
Physics3DQueries
Rays, sweeps and overlaps against a PhysicsWorld3D, answered in entities. Physics3D.queries is one.
Physics3DSchemas
How the 3-D physics components are saved and shown in an editor. Every one is a 3-D component (Dimensions.threeD), in the Physics group the 2-D ones are in — a body and a collider grouped, labelled and described as RigidBody2D and Collider2D are.
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.
PhysicsHit3D
A query's hit, with the entity whose body it hit.
PhysicsSystem3D
Steps a PhysicsWorld3D and keeps it in step with the ECS: the 3-D counterpart of the engine's 2-D PhysicsSystem (a 3-D game leaves that one out).
PhysicsWorld3D
One simulation: bodies, joints and characters that see each other.
PhysicsWorldSettings3D
How a world is made.
PointJoint3D
Holds two bodies at one point, free to turn about it (a ball joint).
QueryFilter3D
What a query looks at.
QueryHit3D
A query's hit.
RigidBody3D
Makes its entity a rigid body that PhysicsSystem3D simulates. It needs a Collider3D on the same entity for its shape.
SensorEnter3DEvent
Something entered a sensor (a RigidBody3D with isSensor): a body, or a detectable character.
SensorExit3DEvent
Something left a sensor.
Shape3D
The shape of a body, a query or a character, as plain data a backend turns into its own.
SixDofJoint3D
Each of the six degrees of freedom free, limited or fixed — anything the other joints cannot express.
SliderJoint3D
Lets two bodies slide along one axis: a drawer, a piston, a lift.
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.

Enums

BodyType3D
How a body moves.
ColliderShape3D
The shapes a Collider3D can be.
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.