Taos API Reference
    Preparing search index...

    Module physics

    The Jolt WASM rigid-body backend: PhysicsWorld body factories (box/sphere/mesh/heightfield/convex-hull), constraints, raycasts, the PhysicsScene GameObject coupling layer, and the per-frame step/sync loop.

    All physics goes through this module — never jolt-physics directly. The Jolt WASM backend is loaded lazily on first use (see initializePhysics / PhysicsWorld.create), in its own chunk, so apps that don't import this module ship none of it. It is intentionally NOT re-exported from the engine's top-level barrel; consumers opt in via the taos/physics subpath, which keeps Jolt out of every physics-free bundle.

    Classes - Components

    RigidBody

    A rigid body. shape + its dimensions pick the collider; motion selects static / dynamic / kinematic. A dynamic body is simulated and writes its pose back onto the GameObject each frame.

    CharacterBody

    A kinematic capsule character. Set velocity (x/z) from a script or circuit each frame; gravity drives y. Calls move-and-slide and writes the resolved position back onto the GameObject.

    TriggerVolume

    A box sensor volume: fires onEnter/onExit as bodies overlap it and tracks how many currently do (isOccupied). Assign the callbacks from a script/circuit. Static (stays at its authored transform).

    Collider

    A single collision shape — Godot's CollisionShape3D. Pure geometry placed by its GameObject's transform; it owns no physics body. The nearest ancestor StaticBody gathers every descendant Collider into one compound body, so each shape is a selectable/editable object yet costs no extra body. Inert on its own (like a CollisionShape3D with no parent body).

    StaticBody

    A static physics body — Godot's StaticBody3D. Builds ONE compound collider from every descendant Collider (stopping at nested bodies), so a whole authored collision group is one broadphase entry while every shape stays an editable GameObject. Always static; the compound is built once the physics world is ready, reading each collider's live world transform at that moment.

    Classes - Physics

    Buoyancy

    Floats the sibling RigidBody on a water surface. Add it to a GameObject that also has a dynamic RigidBody; set waterHeightAt to the ocean surface query.

    Classes - Other

    CharacterController
    PhysicsScene
    PhysicsSystem
    PhysicsWorld

    Interfaces - Physics

    BuoyancyOptions

    Interfaces - Other

    CharacterOptions
    PhysicsInitOptions

    Options for locating the Jolt .wasm when initializing physics. Omit entirely when building with Vite — the default path uses Vite's ?url asset handling to emit, hash, and fetch the .wasm automatically. Supply one of these only for non-Vite bundlers (webpack/rollup/esbuild/…) or to self-host the file (CDN, custom public path), since the ?url import is a Vite-ism other bundlers don't understand.

    DebugLineBuffer

    Growable line-list vertex buffer ([x,y,z, r,g,b] per vertex, world space).

    SpawnOptions

    Options accepted by the spawn helpers: physics tuning + visual styling.

    DebugShape

    A tracked body plus the local-space description of its collision shape(s), so a debug renderer can draw exact collision wireframes at the body's live world transform. Populated by the add* factories; dropped on removeBody/clear.

    SensorCallbacks

    Callbacks for a sensor (trigger) body's overlap events.

    BodyOptions

    Per-body tuning shared by every shape factory.

    Type Aliases

    GroundState

    Coarse ground classification, mirroring Jolt's EGroundState.

    RigidBodyShape

    Shape of a RigidBody.

    ColliderShape

    Shape of a Collider.

    DebugShapePart

    One primitive sub-shape of a body's collision, described in BODY-LOCAL space, for debug visualization. A simple (non-compound) body has a single part at the local origin; a compound collider records one part per sub-shape. Triangle meshes / height-fields / convex hulls are not described here (too detailed to wireframe cheaply) — they simply produce no debug part.

    CompoundSubShape

    One primitive sub-shape of a PhysicsWorld.addCompoundCollider body, in the compound's local space. Box half-extents are per-axis; cylinder / capsule axis is local Y.

    BodyMotion

    How a body participates in the simulation.

    Variables

    DEBUG_LINE_STRIDE_FLOATS

    Floats per vertex in the debug line buffer: position (3) + color (3).

    CollisionLayer

    Named collision layers as bit flags (Godot-style). A body's layer says which layer(s) it belongs to; its mask says which layers it collides with. Two bodies interact only when each one's layer appears in the other's mask (an AND of both directions, matching Jolt's ObjectLayerPairFilterMask). Give "passively collidable" bodies (static world, the player capsule) mask: All and put the selective filtering on the active body (e.g. a bullet that should hit only World | Enemy).

    LAYER_NON_MOVING

    Back-compat alias for the static-geometry layer (was object layer 0).

    LAYER_MOVING

    Back-compat alias for the default dynamic layer (was object layer 1).

    Functions

    initializePhysics

    Loads the Jolt physics backend (the WASM module) on demand. Call once before using physics, or simply await PhysicsWorld.create() which loads it for you. Idempotent — safe to call repeatedly / concurrently.

    isPhysicsInitialized

    True once the physics backend has finished loading.

    gatherColliders

    Every Collider under root that belongs to the body at root — i.e. the whole subtree, but NOT colliders inside a nested StaticBody (which owns its own subtree). Mirrors Godot's "a CollisionShape3D belongs to its nearest ancestor physics body". Exported for testability.

    registerPhysicsComponents

    Register the physics component factories (idempotent; called on module import).

    createDebugLineBuffer

    Creates an empty buffer with room for capacityVerts vertices.

    appendShapeWireframe

    Appends the wireframe of one collision sub-shape to buf. world is the column-major model matrix placing the shape's LOCAL space into world space (body world transform composed with the sub-shape's local offset). color is the line RGB.

    buildPhysicsDebugLines

    Rebuilds buf with wireframes for every collision shape currently in the world, placed at each body's LIVE transform. Reads PhysicsWorld.debugShapes; bodies with no debug description (mesh / hull) contribute nothing. color is the line RGB (default a bright green, Godot-style).

    getPhysicsSystem

    The physics system for an engine, created (and Jolt init kicked off) on first use.

    peekPhysicsSystem

    The physics system for an engine if one exists, without creating it (no Jolt spin-up).

    setPhysicsPaused

    Set the pause state for an engine's physics. Records the desired state even before the system exists (so a later-attached body starts correctly gated) and applies it to a live system. Used by the editor to freeze the sim in edit mode.