# Class QueryPipeline

A pipeline for performing queries on all the colliders of a scene.

To avoid leaking WASM resources, this MUST be freed manually with `queryPipeline.free()` once you are done using it (and all the rigid-bodies it created).

#### Hierarchy

- QueryPipeline

- Defined in pipeline/query_pipeline.d.ts:49

#####
Index

### Constructors

constructor

### Properties

raw

### Methods

castRay
castRayAndGetNormal
castShape
collidersWithAabbIntersectingAabb
free
intersectionWithShape
intersectionsWithPoint
intersectionsWithRay
intersectionsWithShape
projectPoint
projectPointAndGetFeature
update

## Constructors

### constructor

- new QueryPipeline(raw?: RawQueryPipeline): QueryPipeline

- #### Parameters

  - ##### `Optional` raw: RawQueryPipeline

  #### Returns QueryPipeline

  - Defined in pipeline/query_pipeline.d.ts:55

## Properties

### raw

raw: RawQueryPipeline

- Defined in pipeline/query_pipeline.d.ts:50

## Methods

### castRay

- castRay(bodies: RigidBodySet, colliders: ColliderSet, ray: Ray, maxToi: number, solid: boolean, filterFlags?: QueryFilterFlags, filterGroups?: number, filterExcludeCollider?: number, filterExcludeRigidBody?: number, filterPredicate?: ((collider: number) => boolean)): RayColliderHit

- Find the closest intersection between a ray and a set of collider.

  #### Parameters

  - ##### bodies: RigidBodySet

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  - ##### ray: Ray

    The ray to cast.

  - ##### maxToi: number

    The maximum time-of-impact that can be reported by this cast. This effectively limits the length of the ray to `ray.dir.norm() * maxToi`.

  - ##### solid: boolean

    If `false` then the ray will attempt to hit the boundary of a shape, even if its origin already lies inside of a shape. In other terms, `true` implies that all shapes are plain, whereas `false` implies that all shapes are hollow for this ray-cast.

  - ##### `Optional` filterFlags: QueryFilterFlags

  - ##### `Optional` filterGroups: number

  - ##### `Optional` filterExcludeCollider: number

  - ##### `Optional` filterExcludeRigidBody: number

  - ##### `Optional` filterPredicate: ((collider: number) => boolean)

    - - (collider: number): boolean

      - #### Parameters

        - ##### collider: number

        #### Returns boolean

  #### Returns RayColliderHit

  - Defined in pipeline/query_pipeline.d.ts:75

### castRayAndGetNormal

- castRayAndGetNormal(bodies: RigidBodySet, colliders: ColliderSet, ray: Ray, maxToi: number, solid: boolean, filterFlags?: QueryFilterFlags, filterGroups?: number, filterExcludeCollider?: number, filterExcludeRigidBody?: number, filterPredicate?: ((collider: number) => boolean)): RayColliderIntersection

- Find the closest intersection between a ray and a set of collider.

  This also computes the normal at the hit point.

  #### Parameters

  - ##### bodies: RigidBodySet

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  - ##### ray: Ray

    The ray to cast.

  - ##### maxToi: number

    The maximum time-of-impact that can be reported by this cast. This effectively limits the length of the ray to `ray.dir.norm() * maxToi`.

  - ##### solid: boolean

    If `false` then the ray will attempt to hit the boundary of a shape, even if its origin already lies inside of a shape. In other terms, `true` implies that all shapes are plain, whereas `false` implies that all shapes are hollow for this ray-cast.

  - ##### `Optional` filterFlags: QueryFilterFlags

  - ##### `Optional` filterGroups: number

  - ##### `Optional` filterExcludeCollider: number

  - ##### `Optional` filterExcludeRigidBody: number

  - ##### `Optional` filterPredicate: ((collider: number) => boolean)

    - - (collider: number): boolean

      - #### Parameters

        - ##### collider: number

        #### Returns boolean

  #### Returns RayColliderIntersection

  - Defined in pipeline/query_pipeline.d.ts:89

### castShape

- castShape(bodies: RigidBodySet, colliders: ColliderSet, shapePos: Vector, shapeRot: Rotation, shapeVel: Vector, shape: Shape, targetDistance: number, maxToi: number, stopAtPenetration: boolean, filterFlags?: QueryFilterFlags, filterGroups?: number, filterExcludeCollider?: number, filterExcludeRigidBody?: number, filterPredicate?: ((collider: number) => boolean)): ColliderShapeCastHit

- Casts a shape at a constant linear velocity and retrieve the first collider it hits. This is similar to ray-casting except that we are casting a whole shape instead of just a point (the ray origin).

  #### Parameters

  - ##### bodies: RigidBodySet

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  - ##### shapePos: Vector

    The initial position of the shape to cast.

  - ##### shapeRot: Rotation

    The initial rotation of the shape to cast.

  - ##### shapeVel: Vector

    The constant velocity of the shape to cast (i.e. the cast direction).

  - ##### shape: Shape

    The shape to cast.

  - ##### targetDistance: number

    − If the shape moves closer to this distance from a collider, a hit will be returned.

  - ##### maxToi: number

    The maximum time-of-impact that can be reported by this cast. This effectively limits the distance traveled by the shape to `shapeVel.norm() * maxToi`.

  - ##### stopAtPenetration: boolean

    If set to `false`, the linear shape-cast won’t immediately stop if the shape is penetrating another shape at its starting point and its trajectory is such that it’s on a path to exist that penetration state.

  - ##### `Optional` filterFlags: QueryFilterFlags

  - ##### `Optional` filterGroups: number

  - ##### `Optional` filterExcludeCollider: number

  - ##### `Optional` filterExcludeRigidBody: number

  - ##### `Optional` filterPredicate: ((collider: number) => boolean)

    - - (collider: number): boolean

      - #### Parameters

        - ##### collider: number

        #### Returns boolean

  #### Returns ColliderShapeCastHit

  - Defined in pipeline/query_pipeline.d.ts:170

### collidersWithAabbIntersectingAabb

- collidersWithAabbIntersectingAabb(aabbCenter: Vector, aabbHalfExtents: Vector, callback: ((handle: number) => boolean)): void

- Finds the handles of all the colliders with an AABB intersecting the given AABB.

  #### Parameters

  - ##### aabbCenter: Vector

    The center of the AABB to test.

  - ##### aabbHalfExtents: Vector

    The half-extents of the AABB to test.

  - ##### callback: ((handle: number) => boolean)

    The callback that will be called with the handles of all the colliders currently intersecting the given AABB.

    - - (handle: number): boolean

      - #### Parameters

        - ##### handle: number

        #### Returns boolean

  #### Returns void

  - Defined in pipeline/query_pipeline.d.ts:191

### free

- free(): void

- Release the WASM memory occupied by this query pipeline.

  #### Returns void

  - Defined in pipeline/query_pipeline.d.ts:54

### intersectionWithShape

- intersectionWithShape(bodies: RigidBodySet, colliders: ColliderSet, shapePos: Vector, shapeRot: Rotation, shape: Shape, filterFlags?: QueryFilterFlags, filterGroups?: number, filterExcludeCollider?: number, filterExcludeRigidBody?: number, filterPredicate?: ((collider: number) => boolean)): number

- Gets the handle of up to one collider intersecting the given shape.

  #### Parameters

  - ##### bodies: RigidBodySet

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  - ##### shapePos: Vector

    The position of the shape used for the intersection test.

  - ##### shapeRot: Rotation

    The orientation of the shape used for the intersection test.

  - ##### shape: Shape

    The shape used for the intersection test.

  - ##### `Optional` filterFlags: QueryFilterFlags

  - ##### `Optional` filterGroups: number

  - ##### `Optional` filterExcludeCollider: number

  - ##### `Optional` filterExcludeRigidBody: number

  - ##### `Optional` filterPredicate: ((collider: number) => boolean)

    - - (collider: number): boolean

      - #### Parameters

        - ##### collider: number

        #### Returns boolean

  #### Returns number

  - Defined in pipeline/query_pipeline.d.ts:115

### intersectionsWithPoint

- intersectionsWithPoint(bodies: RigidBodySet, colliders: ColliderSet, point: Vector, callback: ((handle: number) => boolean), filterFlags?: QueryFilterFlags, filterGroups?: number, filterExcludeCollider?: number, filterExcludeRigidBody?: number, filterPredicate?: ((collider: number) => boolean)): void

- Find all the colliders containing the given point.

  #### Parameters

  - ##### bodies: RigidBodySet

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  - ##### point: Vector

    The point used for the containment test.

  - ##### callback: ((handle: number) => boolean)

    A function called with the handles of each collider with a shape containing the `point`.

    - - (handle: number): boolean

      - #### Parameters

        - ##### handle: number

        #### Returns boolean

  - ##### `Optional` filterFlags: QueryFilterFlags

  - ##### `Optional` filterGroups: number

  - ##### `Optional` filterExcludeCollider: number

  - ##### `Optional` filterExcludeRigidBody: number

  - ##### `Optional` filterPredicate: ((collider: number) => boolean)

    - - (collider: number): boolean

      - #### Parameters

        - ##### collider: number

        #### Returns boolean

  #### Returns void

  - Defined in pipeline/query_pipeline.d.ts:149

### intersectionsWithRay

- intersectionsWithRay(bodies: RigidBodySet, colliders: ColliderSet, ray: Ray, maxToi: number, solid: boolean, callback: ((intersect: RayColliderIntersection) => boolean), filterFlags?: QueryFilterFlags, filterGroups?: number, filterExcludeCollider?: number, filterExcludeRigidBody?: number, filterPredicate?: ((collider: number) => boolean)): void

- Cast a ray and collects all the intersections between a ray and the scene.

  #### Parameters

  - ##### bodies: RigidBodySet

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  - ##### ray: Ray

    The ray to cast.

  - ##### maxToi: number

    The maximum time-of-impact that can be reported by this cast. This effectively limits the length of the ray to `ray.dir.norm() * maxToi`.

  - ##### solid: boolean

    If `false` then the ray will attempt to hit the boundary of a shape, even if its origin already lies inside of a shape. In other terms, `true` implies that all shapes are plain, whereas `false` implies that all shapes are hollow for this ray-cast.

  - ##### callback: ((intersect: RayColliderIntersection) => boolean)

    The callback called once per hit (in no particular order) between a ray and a collider. If this callback returns `false`, then the cast will stop and no further hits will be detected/reported.

    - - (intersect: RayColliderIntersection): boolean

      - #### Parameters

        - ##### intersect: RayColliderIntersection

        #### Returns boolean

  - ##### `Optional` filterFlags: QueryFilterFlags

  - ##### `Optional` filterGroups: number

  - ##### `Optional` filterExcludeCollider: number

  - ##### `Optional` filterExcludeRigidBody: number

  - ##### `Optional` filterPredicate: ((collider: number) => boolean)

    - - (collider: number): boolean

      - #### Parameters

        - ##### collider: number

        #### Returns boolean

  #### Returns void

  - Defined in pipeline/query_pipeline.d.ts:104

### intersectionsWithShape

- intersectionsWithShape(bodies: RigidBodySet, colliders: ColliderSet, shapePos: Vector, shapeRot: Rotation, shape: Shape, callback: ((handle: number) => boolean), filterFlags?: QueryFilterFlags, filterGroups?: number, filterExcludeCollider?: number, filterExcludeRigidBody?: number, filterPredicate?: ((collider: number) => boolean)): void

- Retrieve all the colliders intersecting the given shape.

  #### Parameters

  - ##### bodies: RigidBodySet

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  - ##### shapePos: Vector

    The position of the shape to test.

  - ##### shapeRot: Rotation

    The orientation of the shape to test.

  - ##### shape: Shape

    The shape to test.

  - ##### callback: ((handle: number) => boolean)

    A function called with the handles of each collider intersecting the `shape`.

    - - (handle: number): boolean

      - #### Parameters

        - ##### handle: number

        #### Returns boolean

  - ##### `Optional` filterFlags: QueryFilterFlags

  - ##### `Optional` filterGroups: number

  - ##### `Optional` filterExcludeCollider: number

  - ##### `Optional` filterExcludeRigidBody: number

  - ##### `Optional` filterPredicate: ((collider: number) => boolean)

    - - (collider: number): boolean

      - #### Parameters

        - ##### collider: number

        #### Returns boolean

  #### Returns void

  - Defined in pipeline/query_pipeline.d.ts:182

### projectPoint

- projectPoint(bodies: RigidBodySet, colliders: ColliderSet, point: Vector, solid: boolean, filterFlags?: QueryFilterFlags, filterGroups?: number, filterExcludeCollider?: number, filterExcludeRigidBody?: number, filterPredicate?: ((collider: number) => boolean)): PointColliderProjection

- Find the projection of a point on the closest collider.

  #### Parameters

  - ##### bodies: RigidBodySet

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  - ##### point: Vector

    The point to project.

  - ##### solid: boolean

    If this is set to `true` then the collider shapes are considered to be plain (if the point is located inside of a plain shape, its projection is the point itself). If it is set to `false` the collider shapes are considered to be hollow (if the point is located inside of an hollow shape, it is projected on the shape's boundary).

  - ##### `Optional` filterFlags: QueryFilterFlags

  - ##### `Optional` filterGroups: number

  - ##### `Optional` filterExcludeCollider: number

  - ##### `Optional` filterExcludeRigidBody: number

  - ##### `Optional` filterPredicate: ((collider: number) => boolean)

    - - (collider: number): boolean

      - #### Parameters

        - ##### collider: number

        #### Returns boolean

  #### Returns PointColliderProjection

  - Defined in pipeline/query_pipeline.d.ts:129

### projectPointAndGetFeature

- projectPointAndGetFeature(bodies: RigidBodySet, colliders: ColliderSet, point: Vector, filterFlags?: QueryFilterFlags, filterGroups?: number, filterExcludeCollider?: number, filterExcludeRigidBody?: number, filterPredicate?: ((collider: number) => boolean)): PointColliderProjection

- Find the projection of a point on the closest collider.

  #### Parameters

  - ##### bodies: RigidBodySet

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  - ##### point: Vector

    The point to project.

  - ##### `Optional` filterFlags: QueryFilterFlags

  - ##### `Optional` filterGroups: number

  - ##### `Optional` filterExcludeCollider: number

  - ##### `Optional` filterExcludeRigidBody: number

  - ##### `Optional` filterPredicate: ((collider: number) => boolean)

    - - (collider: number): boolean

      - #### Parameters

        - ##### collider: number

        #### Returns boolean

  #### Returns PointColliderProjection

  - Defined in pipeline/query_pipeline.d.ts:138

### update

- update(bodies: RigidBodySet, colliders: ColliderSet): void

- Updates the acceleration structure of the query pipeline.

  #### Parameters

  - ##### bodies: RigidBodySet

    The set of rigid-bodies taking part in this pipeline.

  - ##### colliders: ColliderSet

    The set of colliders taking part in this pipeline.

  #### Returns void

  - Defined in pipeline/query_pipeline.d.ts:61

Generated using TypeDoc