pub struct RapierQueryPipeline<'a> {
pub query_pipeline: QueryPipeline<'a>,
}Expand description
Wrapper around QueryPipeline to provide bevy friendly methods.
This wrapper is designed to be short lived, made whenever necessary.
See RapierQueryPipeline::new_scoped to create one.
Fields§
§query_pipeline: QueryPipeline<'a>The query pipeline, which performs scene queries (ray-casting, point projection, etc.)
Implementations§
Source§impl<'a> RapierQueryPipeline<'a>
impl<'a> RapierQueryPipeline<'a>
Sourcepub fn new_scoped<T>(
broad_phase: &DefaultBroadPhase,
colliders: &RapierContextColliders,
rigid_bodies: &RapierRigidBodySet,
filter: &QueryFilter<'_>,
dispatcher: &dyn QueryDispatcher,
scoped_fn: impl FnOnce(RapierQueryPipeline<'_>) -> T,
) -> T
pub fn new_scoped<T>( broad_phase: &DefaultBroadPhase, colliders: &RapierContextColliders, rigid_bodies: &RapierRigidBodySet, filter: &QueryFilter<'_>, dispatcher: &dyn QueryDispatcher, scoped_fn: impl FnOnce(RapierQueryPipeline<'_>) -> T, ) -> T
Creates a temporary RapierQueryPipeline and passes it as a parameter to scoped_fn.
Sourcepub fn collider_entity(&self, collider_handle: ColliderHandle) -> Entity
pub fn collider_entity(&self, collider_handle: ColliderHandle) -> Entity
Retrieves the Entity for a given collider handle.
Sourcepub fn cast_ray(
&self,
ray_origin: Vect,
ray_dir: Vect,
max_toi: f32,
solid: bool,
) -> Option<(Entity, f32)>
pub fn cast_ray( &self, ray_origin: Vect, ray_dir: Vect, max_toi: f32, solid: bool, ) -> Option<(Entity, f32)>
Find the closest intersection between a ray and a set of collider.
§Parameters
ray_origin: the starting point of the ray to cast.ray_dir: the direction of 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::MAXfor an unbounded ray.solid: if this istruean impact at time 0.0 (i.e. at the ray origin) is returned if it starts inside of a shape. If thisfalsethen the ray will hit the shape’s boundary even if its starts inside of it.
Sourcepub fn cast_ray_and_get_normal(
&self,
ray_origin: Vect,
ray_dir: Vect,
max_toi: f32,
solid: bool,
) -> Option<(Entity, RayIntersection)>
pub fn cast_ray_and_get_normal( &self, ray_origin: Vect, ray_dir: Vect, max_toi: f32, solid: bool, ) -> Option<(Entity, RayIntersection)>
Find the closest intersection between a ray and a set of collider.
§Parameters
ray_origin: the starting point of the ray to cast.ray_dir: the direction of 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::MAXfor an unbounded ray.solid: if this istruean impact at time 0.0 (i.e. at the ray origin) is returned if it starts inside of a shape. If thisfalsethen the ray will hit the shape’s boundary even if its starts inside of it.
Sourcepub fn intersect_ray(
&'a self,
ray_origin: Vect,
ray_dir: Vect,
max_toi: f32,
solid: bool,
) -> impl Iterator<Item = (Entity, RayIntersection)> + 'a
pub fn intersect_ray( &'a self, ray_origin: Vect, ray_dir: Vect, max_toi: f32, solid: bool, ) -> impl Iterator<Item = (Entity, RayIntersection)> + 'a
Iterates through all the colliders intersecting a given ray.
§Parameters
ray_origin: the starting point of the ray to cast.ray_dir: the direction of 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::MAXfor an unbounded ray.solid: if this istruean impact at time 0.0 (i.e. at the ray origin) is returned if it starts inside of a shape. If thisfalsethen the ray will hit the shape’s boundary even if its starts inside of it.
Sourcepub fn intersect_shape(
&'a self,
shape_pos: Vect,
shape_rot: Rot,
shape: &'a dyn Shape,
) -> impl Iterator<Item = Entity> + 'a
pub fn intersect_shape( &'a self, shape_pos: Vect, shape_rot: Rot, shape: &'a dyn Shape, ) -> impl Iterator<Item = Entity> + 'a
Retrieve all the colliders intersecting the given shape.
§Parameters
shape_pos- The position of the shape used for the intersection test.shape- The shape used for the intersection test.
Sourcepub fn project_point(
&self,
point: Vect,
max_dist: f32,
solid: bool,
) -> Option<(Entity, PointProjection)>
pub fn project_point( &self, point: Vect, max_dist: f32, solid: bool, ) -> Option<(Entity, PointProjection)>
Find the projection of a point on the closest collider.
§Parameters
point- The point to project.solid- If this is set totruethen 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 tofalsethe 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: Vect,
) -> impl Iterator<Item = Entity> + 'a
pub fn intersect_point( &'a self, point: Vect, ) -> impl Iterator<Item = Entity> + '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: Vect,
) -> Option<(Entity, PointProjection, FeatureId)>
pub fn project_point_and_get_feature( &self, point: Vect, ) -> Option<(Entity, 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.solid- If this is set totruethen 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 tofalsethe 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_aabb_conservative(
&'a self,
aabb: Aabb3d,
) -> impl Iterator<Item = Entity> + 'a
pub fn intersect_aabb_conservative( &'a self, aabb: Aabb3d, ) -> impl Iterator<Item = Entity> + 'a
Sourcepub fn cast_shape(
&'a self,
shape_pos: Vect,
shape_rot: Rot,
shape_vel: Vect,
shape: &dyn Shape,
options: ShapeCastOptions,
) -> Option<(Entity, ShapeCastHit)>
pub fn cast_shape( &'a self, shape_pos: Vect, shape_rot: Rot, shape_vel: Vect, shape: &dyn Shape, options: ShapeCastOptions, ) -> Option<(Entity, 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 ShapeCastHit, witness and normal 1 refer to the world
collider, and are in world space.
§Parameters
shape_pos- The initial translation of the shape to cast.shape_rot- The rotation 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.max_toi- The maximum time-of-impact that can be reported by this cast. This effectively limits the distance traveled by the shape toshape_vel.norm() * maxToi.stop_at_penetration- If the casted shape starts in a penetration state with any collider, two results are possible. Ifstop_at_penetrationistruethen, the result will have atoiequal tostart_time. Ifstop_at_penetrationisfalsethen the nonlinear shape-casting will see if further motion wrt. 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_timethat could result in tunnelling.
Trait Implementations§
Source§impl<'a> Clone for RapierQueryPipeline<'a>
impl<'a> Clone for RapierQueryPipeline<'a>
Source§fn clone(&self) -> RapierQueryPipeline<'a>
fn clone(&self) -> RapierQueryPipeline<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a> Copy for RapierQueryPipeline<'a>
Auto Trait Implementations§
impl<'a> Freeze for RapierQueryPipeline<'a>
impl<'a> !RefUnwindSafe for RapierQueryPipeline<'a>
impl<'a> !Send for RapierQueryPipeline<'a>
impl<'a> !Sync for RapierQueryPipeline<'a>
impl<'a> Unpin for RapierQueryPipeline<'a>
impl<'a> !UnwindSafe for RapierQueryPipeline<'a>
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Source§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.