Skip to content

Namespace Apogee.Physics

Classes

BodyDesc

What a body is made of and how it behaves: the shape, how it moves, its mass, surface and layers. Fill one in and give it to ; the same description can make any number of bodies. Where the body is comes from its entity's transform (its scale is applied to the shape).

CharacterController

A walking character: a capsule that slides along walls, climbs stairs and slopes, sticks to the ground going down and stands on moving platforms, without being a rigid body (Jolt's CharacterVirtual). Make one with ; it moves in every fixed step toward , and its entity's transform (the feet) follows, blended between steps like a dynamic body's. Dynamic bodies are pushed by it and do not push it.

Hitch

A hitch on a vehicle: a point on its body where an attachment or a trailer is attached. The hitch is an entity under the vehicle's, whose transform is the hitch's frame in the vehicle's space; takes the attachment's entity and the attach point in the attachment's space, which meets the hitch's frame. Make one with . A hitch holds one body at a time; the pair do not collide while hitched.

PhysicsDebugOptions

What puts in a .

PhysicsException

The physics library could not do what was asked (it did not load, or Jolt refused a shape).

PhysicsLayers

Which bodies collide with which. A body has , the collision layers it belongs to (a bit each), and , the layers it collides with; two bodies collide when each is in a layer the other's mask holds. There are 14 layers for the game (bits 0 to 13). The native layer keeps two more bits of its own to sort bodies into the broad phase (static, sensor, moving); static bodies never collide with each other. See Native/jolt/apogee_jolt.h.

PhysicsOptions

How a is made. The defaults suit heavy vehicles on a large map.

PhysicsShape

A collision shape: an immutable thing a body (or another shape) is made of, in the body's local space. Made with the static functions, given to , and shared freely: many bodies can use one. Jolt counts references, so a shape that a script lets go of lives on in the bodies that use it.

PhysicsWorld

The physics simulation of one ECS : Jolt Physics with double-precision positions, stepped at a fixed rate. Entities get a with ; a dynamic body's entity follows the simulation (its is written, local to its parent, so the world's transform system then fills in the ), and a kinematic body follows its entity.

Vehicle

A vehicle on a dynamic body: wheels with suspension and tires, or tracks, an engine and a clutch (Jolt's VehicleConstraint). The game owns the gearbox: it sets (the signed overall ratio it wants, 0 for neutral) and in the signal, which runs before each physics step, together with the driver's inputs, and the vehicle gives them to Jolt. Make one with .

VehicleDesc

A vehicle: its engine, drivetrain and wheels. Give it to with the entity of a dynamic body.

WheelDesc

One wheel of a vehicle. The vehicle's space has +Z forward, +Y up and +X to its left (glTF's). Its is where the wheel's center sits with its suspension fully extended: the suspension reaches above that, and the wheel rests somewhere in that travel under the load.

Structs

Body

An entity that has a body in the physics world (). Removing it, or destroying the entity, removes the body. The fields are for tools and inspectors; code asks the world ().

Enums

DriveKind

What drives a vehicle's wheels.

HitchKind

How a hitch holds what it carries.

MotionKind

How a body moves.