RapierQueryPipeline

Struct RapierQueryPipeline 

Source
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>

Source

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.

Source

pub fn collider_entity(&self, collider_handle: ColliderHandle) -> Entity

Retrieves the Entity for a given collider handle.

Source

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 to ray.dir.norm() * max_toi. Use Real::MAX for an unbounded ray.
  • solid: if this is true an impact at time 0.0 (i.e. at the ray origin) is returned if it starts inside of a shape. If this false then the ray will hit the shape’s boundary even if its starts inside of it.
Source

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 to ray.dir.norm() * max_toi. Use Real::MAX for an unbounded ray.
  • solid: if this is true an impact at time 0.0 (i.e. at the ray origin) is returned if it starts inside of a shape. If this false then the ray will hit the shape’s boundary even if its starts inside of it.
Source

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 to ray.dir.norm() * max_toi. Use Real::MAX for an unbounded ray.
  • solid: if this is true an impact at time 0.0 (i.e. at the ray origin) is returned if it starts inside of a shape. If this false then the ray will hit the shape’s boundary even if its starts inside of it.
Source

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

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

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

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

pub fn intersect_aabb_conservative( &'a self, aabb: Aabb3d, ) -> impl Iterator<Item = Entity> + 'a

Finds all handles of all the colliders with an Aabb intersecting the given Aabb.

Note that the collider AABB taken into account is the one currently stored in the query pipeline’s BVH. It doesn’t recompute the latest collider AABB.

Source

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 to shape_vel.norm() * maxToi.
  • stop_at_penetration - If the casted shape starts in a penetration state with any collider, two results are possible. If stop_at_penetration is true then, the result will have a toi equal to start_time. If stop_at_penetration is false then 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_time that could result in tunnelling.

Trait Implementations§

Source§

impl<'a> Clone for RapierQueryPipeline<'a>

Source§

fn clone(&self) -> RapierQueryPipeline<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

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

Converts &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)

Converts &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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more