Small World Engine API Reference - v0.78.00
    Preparing search index...

    Class PhysicsBroadphase

    Manages the spatial acceleration structure (Octree) with temporal coherence and fattened AABBs. Objects that remain within their fattened bounding shell skip expensive spatial re-sorting.

    Index
    fatMargin: number

    Safety margin added to tight collider bounds to create the fattened AABB shell.

    movedCount: number = 0

    Number of colliders that moved outside their fat bounds and were re-inserted.

    skippedCount: number = 0

    Number of colliders that skipped spatial re-sorting in the last update frame.

    velocityMultiplier: number

    Lookahead factor to expand fat AABB along current velocity vector.

    • Queries the broadphase Octree and fallback list for colliders intersecting the given mathematical ray.

      Parameters

      • ray: Ray

        Target ray.

      • outHits: Collidable[]

        Array receiving the potential collider candidates.

      • mask: number = 0xffffffff

        Optional 32-bit collision layer mask to filter candidates (default: 0xFFFFFFFF).

      Returns void

    • Queries the broadphase Octree and fallback list for colliders intersecting the given volume.

      Parameters

      • volume: BoundingVolume

        Target bounding volume.

      • outHits: Collidable[]

        Array receiving the potential collider candidates.

      • mask: number = 0xffffffff

        Optional 32-bit collision layer mask to filter candidates (default: 0xFFFFFFFF).

      Returns void

    • Re-inserts a collider whose position changed outside the normal update cycle (e.g. a body whose position was clamped by CCD after update() already placed it). Recomputes the fat shell from the current tight bounds and places the collider at its new octree node, so subsequent queries around the body's actual position cannot miss it.

      Parameters

      Returns void

    • Rebuilds or incrementally updates the Octree broadphase structure with temporal coherence. Colliders that stay within their fattened bounding shell skip tree removal/reinsertion.

      Parameters

      • allColliders: readonly Collidable[]

        Array of all collidable entities.

      Returns void