Documentation
    Preparing search index...

    Interface RaycastQuery

    A ray cast through the world (§30, §37 raycast).

    The ray is carried inline rather than as a separate Ray object — see the module header.

    interface RaycastQuery {
        collisionGroups?: number;
        collisionMask?: number;
        direction: Vector3Input;
        ignoredBodies?: readonly PhysicsBodyHandle[];
        ignoredColliders?: readonly PhysicsColliderHandle[];
        includeSensors?: boolean;
        maxDistance?: number;
        maxHits?: number;
        mode?: QueryHitMode;
        origin: Vector3Input;
        predicate?: (candidate: QueryCandidate) => boolean;
        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.

    direction: Vector3Input

    Direction of the ray in world space. Need not be unit length; hit distances are reported in world units along the normalized direction, so the magnitude does not scale them.

    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.

    maxDistance?: number

    How far along the ray to search, in world units. Defaults to unbounded.

    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.

    origin: Vector3Input

    Start of the ray in world space. A Vector2 widens to z = 0.

    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).

    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.