Documentation
    Preparing search index...

    Interface ShapeCastQuery

    A shape swept through the world (§30, §37 shapeCast).

    §30 spells the world-level call shapeCast(shape, transform, direction, options); the transform is decomposed here into position and rotation so a caller does not have to build a Transform for a query, and so the 2D convenience forms (a Vector2 position, a radian angle) apply as they do everywhere else.

    interface ShapeCastQuery {
        collisionGroups?: number;
        collisionMask?: number;
        direction: Vector3Input;
        ignoredBodies?: readonly PhysicsBodyHandle[];
        ignoredColliders?: readonly PhysicsColliderHandle[];
        includeSensors?: boolean;
        maxDistance?: number;
        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.

    direction: Vector3Input

    Sweep direction in world space; need not be unit length.

    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 to sweep, 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.

    position: Vector3Input

    Where the sweep starts, 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

    The shape's orientation during the sweep. Defaults to identity.

    The shape to sweep. 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.