Documentation
    Preparing search index...

    Interface QueryFilter

    Which colliders a query is allowed to see (§30).

    Interaction is mutual, the convention every solver this API sits above uses: a query and a collider interact when each one's groups appear in the other's mask.

    (query.collisionGroups & candidate.collisionMask) !== 0
      && (candidate.collisionGroups & query.collisionMask) !== 0
    

    Requiring both directions means a collider can opt out of a query it does not want to answer, which one-directional masking cannot express. Both values default to ALL_COLLISION_GROUPS, so a filter that mentions neither sees everything.

    interface QueryFilter {
        collisionGroups?: number;
        collisionMask?: number;
        ignoredBodies?: readonly PhysicsBodyHandle[];
        ignoredColliders?: readonly PhysicsColliderHandle[];
        includeSensors?: boolean;
        predicate?: (candidate: QueryCandidate) => 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.

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