Options
All
  • Public
  • Public/Protected
  • All
Menu

Class QueryPipeline

A pipeline for performing queries on all the colliders of a scene. 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).

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

Index

Constructors

constructor

  • Parameters

    • Optional raw: RawQueryPipeline

    Returns QueryPipeline

  • Parameters

    • Optional raw: RawQueryPipeline

    Returns QueryPipeline

Properties

raw

raw: RawQueryPipeline

Methods

castRay

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

    Parameters

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    Returns RayColliderToi | null

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

    Parameters

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    Returns RayColliderToi | null

castRayAndGetNormal

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

    This also computes the normal at the hit point.

    Parameters

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    Returns RayColliderIntersection | null

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

    This also computes the normal at the hit point.

    Parameters

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    Returns RayColliderIntersection | null

castShape

  • 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

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

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

    • groups: InteractionGroups

      The bit groups and filter associated to the shape to cast, in order to only test on colliders with collision groups compatible with this group.

    Returns ShapeColliderTOI | null

  • 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

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

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

    • groups: InteractionGroups

      The bit groups and filter associated to the shape to cast, in order to only test on colliders with collision groups compatible with this group.

    Returns ShapeColliderTOI | null

collidersWithAabbIntersectingAabb

  • collidersWithAabbIntersectingAabb(aabbCenter: Vector, aabbHalfExtents: Vector, callback: (handle: ColliderHandle) => boolean): void
  • collidersWithAabbIntersectingAabb(aabbCenter: Vector, aabbHalfExtents: Vector, callback: (handle: ColliderHandle) => 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: ColliderHandle) => boolean

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

    Returns 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: ColliderHandle) => boolean

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

    Returns void

free

  • free(): void
  • free(): void
  • Release the WASM memory occupied by this query pipeline.

    Returns void

  • Release the WASM memory occupied by this query pipeline.

    Returns void

intersectionWithShape

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

    Parameters

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

    • groups: InteractionGroups

      The bit groups and filter associated to the ray, in order to only hit the colliders with collision groups compatible with the ray's group.

    Returns ColliderHandle | null

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

    Parameters

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

    • groups: InteractionGroups

      The bit groups and filter associated to the ray, in order to only hit the colliders with collision groups compatible with the ray's group.

    Returns ColliderHandle | null

intersectionsWithPoint

  • Find all the colliders containing the given point.

    Parameters

    • colliders: ColliderSet

      The set of colliders taking part in this pipeline.

    • point: Vector

      The point used for the containment test.

    • groups: InteractionGroups

      The bit groups and filter associated to the point to test, in order to only test on colliders with collision groups compatible with the ray's group.

    • callback: (ColliderHandle: any) => boolean

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

        • (ColliderHandle: any): boolean
        • Parameters

          • ColliderHandle: any

          Returns boolean

    Returns void

  • Find all the colliders containing the given point.

    Parameters

    • colliders: ColliderSet

      The set of colliders taking part in this pipeline.

    • point: Vector

      The point used for the containment test.

    • groups: InteractionGroups

      The bit groups and filter associated to the point to test, in order to only test on colliders with collision groups compatible with the ray's group.

    • callback: (ColliderHandle: any) => boolean

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

        • (ColliderHandle: any): boolean
        • Parameters

          • ColliderHandle: any

          Returns boolean

    Returns void

intersectionsWithRay

  • intersectionsWithRay(colliders: ColliderSet, ray: Ray, maxToi: number, solid: boolean, groups: InteractionGroups, callback: (RayColliderIntersection: any) => boolean): void
  • intersectionsWithRay(colliders: ColliderSet, ray: Ray, maxToi: number, solid: boolean, groups: InteractionGroups, callback: (RayColliderIntersection: any) => boolean): void
  • Cast a ray and collects all the intersections between a ray and the scene.

    Parameters

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    • callback: (RayColliderIntersection: any) => 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.

        • (RayColliderIntersection: any): boolean
        • Parameters

          • RayColliderIntersection: any

          Returns boolean

    Returns void

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

    Parameters

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    • callback: (RayColliderIntersection: any) => 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.

        • (RayColliderIntersection: any): boolean
        • Parameters

          • RayColliderIntersection: any

          Returns boolean

    Returns void

intersectionsWithShape

  • Retrieve all the colliders intersecting the given shape.

    Parameters

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

    • groups: InteractionGroups

      The bit groups and filter associated to the shape to test, in order to only test on colliders with collision groups compatible with this group.

    • callback: (handle: ColliderHandle) => boolean

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

    Returns void

  • Retrieve all the colliders intersecting the given shape.

    Parameters

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

    • groups: InteractionGroups

      The bit groups and filter associated to the shape to test, in order to only test on colliders with collision groups compatible with this group.

    • callback: (handle: ColliderHandle) => boolean

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

    Returns void

projectPoint

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

    Parameters

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

    • groups: InteractionGroups

      The bit groups and filter associated to the point to project, in order to only project on colliders with collision groups compatible with the ray's group.

    Returns PointColliderProjection | null

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

    Parameters

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

    • groups: InteractionGroups

      The bit groups and filter associated to the point to project, in order to only project on colliders with collision groups compatible with the ray's group.

    Returns PointColliderProjection | null

update

  • Updates the acceleration structure of the query pipeline.

    Parameters

    Returns void

  • Updates the acceleration structure of the query pipeline.

    Parameters

    Returns void

Generated using TypeDoc