pub struct QueryPipeline<'a> {
pub dispatcher: &'a dyn QueryDispatcher,
pub bvh: &'a Bvh,
pub bodies: &'a RigidBodySet,
pub colliders: &'a ColliderSet,
pub filter: QueryFilter<'a>,
}
Expand description
The query pipeline responsible for running scene queries on the physics world.
This structure is generally obtained by calling BroadPhaseBvh::as_query_pipeline_mut
.
Fields§
§dispatcher: &'a dyn QueryDispatcher
The query dispatcher for running geometric queries on leaf geometries.
bvh: &'a Bvh
A bvh containing collider indices at its leaves.
bodies: &'a RigidBodySet
Rigid-bodies potentially involved in the scene queries.
colliders: &'a ColliderSet
Colliders potentially involved in the scene queries.
filter: QueryFilter<'a>
The query filters for controlling what colliders should be ignored by the queries.
Implementations§
Source§impl<'a> QueryPipeline<'a>
impl<'a> QueryPipeline<'a>
Sourcepub fn with_filter(self, filter: QueryFilter<'a>) -> Self
pub fn with_filter(self, filter: QueryFilter<'a>) -> Self
Replaces Self::filter
with different filtering rules.
Sourcepub fn cast_ray(
&self,
ray: &Ray,
max_toi: f32,
solid: bool,
) -> Option<(ColliderHandle, f32)>
pub fn cast_ray( &self, ray: &Ray, max_toi: f32, solid: bool, ) -> Option<(ColliderHandle, f32)>
Find the closest intersection between a ray and a set of colliders.
§Parameters
colliders
- The set of colliders taking part in this pipeline.ray
: the ray to cast.max_toi
: the maximum time-of-impact that can be reported by this cast. This effectively limits the length of the ray toray.dir.norm() * max_toi
. UseReal::MAX
for an unbounded ray.solid
: if this istrue
an impact at time 0.0 (i.e. at the ray origin) is returned if it starts inside a shape. If thisfalse
then the ray will hit the shape’s boundary even if its starts inside of it.filter
: set of rules used to determine which collider is taken into account by this scene query.
Sourcepub fn cast_ray_and_get_normal(
&self,
ray: &Ray,
max_toi: f32,
solid: bool,
) -> Option<(ColliderHandle, RayIntersection)>
pub fn cast_ray_and_get_normal( &self, ray: &Ray, max_toi: f32, solid: bool, ) -> Option<(ColliderHandle, RayIntersection)>
Find the closest intersection between a ray and a set of colliders.
§Parameters
colliders
- The set of colliders taking part in this pipeline.ray
: the ray to cast.max_toi
: the maximum time-of-impact that can be reported by this cast. This effectively limits the length of the ray toray.dir.norm() * max_toi
. UseReal::MAX
for an unbounded ray.solid
: if this istrue
an impact at time 0.0 (i.e. at the ray origin) is returned if it starts inside a shape. If thisfalse
then the ray will hit the shape’s boundary even if its starts inside of it.filter
: set of rules used to determine which collider is taken into account by this scene query.
Sourcepub fn intersect_ray(
&'a self,
ray: Ray,
max_toi: f32,
solid: bool,
) -> impl Iterator<Item = (ColliderHandle, &'a Collider, RayIntersection)> + 'a
pub fn intersect_ray( &'a self, ray: Ray, max_toi: f32, solid: bool, ) -> impl Iterator<Item = (ColliderHandle, &'a Collider, RayIntersection)> + 'a
Iterates through all the colliders intersecting a given ray.
§Parameters
colliders
- The set of colliders taking part in this pipeline.ray
: the ray to cast.max_toi
: the maximum time-of-impact that can be reported by this cast. This effectively limits the length of the ray toray.dir.norm() * max_toi
. UseReal::MAX
for an unbounded ray.solid
: if this istrue
an impact at time 0.0 (i.e. at the ray origin) is returned if it starts inside a shape. If thisfalse
then the ray will hit the shape’s boundary even if its starts inside of it.
Sourcepub fn project_point(
&self,
point: &Point<f32>,
_max_dist: f32,
solid: bool,
) -> Option<(ColliderHandle, PointProjection)>
pub fn project_point( &self, point: &Point<f32>, _max_dist: f32, solid: bool, ) -> Option<(ColliderHandle, PointProjection)>
Find the projection of a point on the closest collider.
§Parameters
point
- The point to project.solid
- If this is set totrue
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 tofalse
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).
Sourcepub fn intersect_point(
&'a self,
point: Point<f32>,
) -> impl Iterator<Item = (ColliderHandle, &'a Collider)> + 'a
pub fn intersect_point( &'a self, point: Point<f32>, ) -> impl Iterator<Item = (ColliderHandle, &'a Collider)> + 'a
Find all the colliders containing the given point.
§Parameters
point
- The point used for the containment test.
Sourcepub fn project_point_and_get_feature(
&self,
point: &Point<f32>,
) -> Option<(ColliderHandle, PointProjection, FeatureId)>
pub fn project_point_and_get_feature( &self, point: &Point<f32>, ) -> Option<(ColliderHandle, PointProjection, FeatureId)>
Find the projection of a point on the closest collider.
The results include the ID of the feature hit by the point.
§Parameters
point
- The point to project.
Sourcepub fn intersect_aabb_conservative(
&'a self,
aabb: Aabb,
) -> impl Iterator<Item = (ColliderHandle, &'a Collider)> + 'a
pub fn intersect_aabb_conservative( &'a self, aabb: Aabb, ) -> impl Iterator<Item = (ColliderHandle, &'a Collider)> + 'a
Sourcepub fn cast_shape(
&self,
shape_pos: &Isometry<f32>,
shape_vel: &Vector<f32>,
shape: &dyn Shape,
options: ShapeCastOptions,
) -> Option<(ColliderHandle, ShapeCastHit)>
pub fn cast_shape( &self, shape_pos: &Isometry<f32>, shape_vel: &Vector<f32>, shape: &dyn Shape, options: ShapeCastOptions, ) -> Option<(ColliderHandle, ShapeCastHit)>
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). In the resulting TOI
, witness and normal 1 refer to the world
collider, and are in world space.
§Parameters
shape_pos
- The initial position of the shape to cast.shape_vel
- The constant velocity of the shape to cast (i.e. the cast direction).shape
- The shape to cast.options
- Options controlling the shape cast limits and behavior.
Sourcepub fn cast_shape_nonlinear(
&self,
shape_motion: &NonlinearRigidMotion,
shape: &dyn Shape,
start_time: f32,
end_time: f32,
stop_at_penetration: bool,
) -> Option<(ColliderHandle, ShapeCastHit)>
pub fn cast_shape_nonlinear( &self, shape_motion: &NonlinearRigidMotion, shape: &dyn Shape, start_time: f32, end_time: f32, stop_at_penetration: bool, ) -> Option<(ColliderHandle, ShapeCastHit)>
Casts a shape with an arbitrary continuous motion and retrieve the first collider it hits.
In the resulting TOI
, witness and normal 1 refer to the world collider, and are in world
space.
§Parameters
shape_motion
- The motion of the shape.shape
- The shape to cast.start_time
- The starting time of the interval where the motion takes place.end_time
- The end time of the interval where the motion takes place.stop_at_penetration
- If the casted shape starts in a penetration state with any collider, two results are possible. Ifstop_at_penetration
istrue
then, the result will have atoi
equal tostart_time
. Ifstop_at_penetration
isfalse
then the nonlinear shape-casting will see if further motion with respect to the penetration normal would result in tunnelling. If it does not (i.e. we have a separating velocity along that normal) then the nonlinear shape-casting will attempt to find another impact, at a time> start_time
that could result in tunnelling.
Sourcepub fn intersect_shape(
&'a self,
shape_pos: Isometry<f32>,
shape: &'a dyn Shape,
) -> impl Iterator<Item = (ColliderHandle, &'a Collider)> + 'a
pub fn intersect_shape( &'a self, shape_pos: Isometry<f32>, shape: &'a dyn Shape, ) -> impl Iterator<Item = (ColliderHandle, &'a Collider)> + 'a
Retrieve all the colliders intersecting the given shape.
§Parameters
shapePos
- The pose of the shape to test.shape
- The shape to test.
Trait Implementations§
Source§impl<'a> Clone for QueryPipeline<'a>
impl<'a> Clone for QueryPipeline<'a>
Source§fn clone(&self) -> QueryPipeline<'a>
fn clone(&self) -> QueryPipeline<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl CompositeShape for QueryPipeline<'_>
impl CompositeShape for QueryPipeline<'_>
Source§impl TypedCompositeShape for QueryPipeline<'_>
impl TypedCompositeShape for QueryPipeline<'_>
type PartNormalConstraints = ()
type PartShape = dyn Shape
fn map_typed_part_at<T>( &self, shape_id: u32, f: impl FnMut(Option<&Isometry<f32>>, &Self::PartShape, Option<&Self::PartNormalConstraints>) -> T, ) -> Option<T>
fn map_untyped_part_at<T>( &self, shape_id: u32, f: impl FnMut(Option<&Isometry<f32>>, &dyn Shape, Option<&dyn NormalConstraints>) -> T, ) -> Option<T>
impl<'a> Copy for QueryPipeline<'a>
Auto Trait Implementations§
impl<'a> Freeze for QueryPipeline<'a>
impl<'a> !RefUnwindSafe for QueryPipeline<'a>
impl<'a> !Send for QueryPipeline<'a>
impl<'a> !Sync for QueryPipeline<'a>
impl<'a> Unpin for QueryPipeline<'a>
impl<'a> !UnwindSafe for QueryPipeline<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.