Documentation
    Preparing search index...

    Interface OverlapQuery

    Everything overlapping a static shape (§30, §37 overlap).

    This one record covers both §30 world-level forms: overlapSphere is an overlap with a "sphere" shape (a "circle" in a "2d" world) and overlapBox one with a "box" (a "rectangle" in 2D), exactly as §21 requires — parallel naming, one API surface.

    interface OverlapQuery {
        collisionGroups?: number;
        collisionMask?: number;
        ignoredBodies?: readonly PhysicsBodyHandle[];
        ignoredColliders?: readonly PhysicsColliderHandle[];
        includeSensors?: boolean;
        maxHits?: number;
        mode?: QueryHitMode;
        position: Vector3Input;
        predicate?: (candidate: QueryCandidate) => boolean;
        rotation?: RotationInput;
        shape: CollisionShape;
        sorted?: boolean;
    }

    Hierarchy (View Summary)

    Index
    collisionGroups?: number

    Bit set of groups the query belongs to. Defaults to every bit.

    collisionMask?: number

    Bit set of groups the query may hit. Defaults to every bit.

    ignoredBodies?: readonly PhysicsBodyHandle[]

    Bodies to skip entirely — §30's "ignored bodies", whose canonical use is excluding the character that cast the ray. Compared by handle identity.

    ignoredColliders?: readonly PhysicsColliderHandle[]

    Individual colliders to skip, for when a body has several and only some should be invisible to the query.

    includeSensors?: boolean

    Whether sensors take part (§30 "sensor inclusion"). Defaults to false: a sensor exerts no forces (§24) and is usually a trigger volume rather than geometry, so line-of-sight and ground checks should not stop at one.

    maxHits?: number

    Upper bound on the number of hits returned. Defaults to unbounded, and is forced to 1 when mode is "first".

    Stop at the first hit or collect them all (§30). Defaults to "all". "first" means the nearest hit for the ray and shape casts, which sweep in order; for overlap and point queries, where there is no natural order, it means an arbitrary one.

    position: Vector3Input

    Centre of the shape in world space.

    predicate?: (candidate: QueryCandidate) => boolean

    §30's "custom filters" — the last word on whether a candidate counts.

    Called after the cheap tests above have passed, once per candidate, and must be a pure function of its argument: it runs inside the query, its call order is the solver's traversal order, and a predicate with side effects would make query results depend on that order (§33).

    rotation?: RotationInput

    Orientation of the shape. Defaults to identity.

    The volume to test. Must suit the world's dimension (§21, §24).

    sorted?: boolean

    Sort hits by ascending distance before returning them (§30 "sorted hits"). Defaults to false, because sorting costs and many callers only count or scan. Ignored for OverlapQuery, whose hits carry no distance.