Struct heron::rapier_plugin::rapier::pipeline::QueryPipeline [−]
pub struct QueryPipeline { /* fields omitted */ }
A pipeline for performing queries on all the colliders of a scene.
Implementations
impl QueryPipeline
pub fn new() -> QueryPipeline
Initializes an empty query pipeline.
pub fn with_query_dispatcher<D>(d: D) -> QueryPipeline where
D: 'static + QueryDispatcher,
D: 'static + QueryDispatcher,
Initializes an empty query pipeline with a custom QueryDispatcher
.
Use this constructor in order to use a custom QueryDispatcher
that is
aware of your own user-defined shapes.
pub fn query_dispatcher(&self) -> &dyn QueryDispatcher
The query dispatcher used by this query pipeline for running scene queries.
pub fn update(&mut self, bodies: &RigidBodySet, colliders: &ColliderSet)
Update the acceleration structure on the query pipeline.
pub fn update_with_mode(
&mut self,
bodies: &RigidBodySet,
colliders: &ColliderSet,
mode: QueryPipelineMode
)
&mut self,
bodies: &RigidBodySet,
colliders: &ColliderSet,
mode: QueryPipelineMode
)
Update the acceleration structure on the query pipeline.
pub fn cast_ray(
&self,
colliders: &ColliderSet,
ray: &Ray,
max_toi: f32,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, f32)>
&self,
colliders: &ColliderSet,
ray: &Ray,
max_toi: f32,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, f32)>
Find the closest intersection between a ray and a set of collider.
Parameters
position
: the position of this shape.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 of a shape. If thisfalse
then the ray will hit the shape’s boundary even if its starts inside of it.query_groups
: the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
: a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.
pub fn cast_ray_and_get_normal(
&self,
colliders: &ColliderSet,
ray: &Ray,
max_toi: f32,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, RayIntersection)>
&self,
colliders: &ColliderSet,
ray: &Ray,
max_toi: f32,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, RayIntersection)>
Find the closest intersection between a ray and a set of collider.
Parameters
position
: the position of this shape.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 of a shape. If thisfalse
then the ray will hit the shape’s boundary even if its starts inside of it.query_groups
: the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
: a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.
pub fn intersections_with_ray<'a>(
&self,
colliders: &'a ColliderSet,
ray: &Ray,
max_toi: f32,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>,
callback: impl FnMut(ColliderHandle, &'a Collider, RayIntersection) -> bool
)
&self,
colliders: &'a ColliderSet,
ray: &Ray,
max_toi: f32,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>,
callback: impl FnMut(ColliderHandle, &'a Collider, RayIntersection) -> bool
)
Find the all intersections between a ray and a set of collider and passes them to a callback.
Parameters
position
: the position of this shape.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 of a shape. If thisfalse
then the ray will hit the shape’s boundary even if its starts inside of it.query_groups
: the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
: a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.callback
: function executed on each collider for which a ray intersection has been found. There is no guarantees on the order the results will be yielded. If this callback returnsfalse
, this method will exit early, ignore any further raycast.
pub fn intersection_with_shape(
&self,
colliders: &ColliderSet,
shape_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>,
shape: &(dyn Shape + 'static),
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<ColliderHandle>
&self,
colliders: &ColliderSet,
shape_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>,
shape: &(dyn Shape + 'static),
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<ColliderHandle>
Gets the handle of up to one collider intersecting the given shape.
Parameters
colliders
- The set of colliders taking part in this pipeline.shape_pos
- The position of the shape used for the intersection test.shape
- The shape used for the intersection test.query_groups
- the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
- a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.
pub fn project_point(
&self,
colliders: &ColliderSet,
point: &Point<f32, 3_usize>,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, PointProjection)>
&self,
colliders: &ColliderSet,
point: &Point<f32, 3_usize>,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, PointProjection)>
Find the projection of a point on the closest collider.
Parameters
colliders
- The set of colliders taking part in this pipeline.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).query_groups
- the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
- a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.
pub fn intersections_with_point<'a>(
&self,
colliders: &'a ColliderSet,
point: &Point<f32, 3_usize>,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>,
callback: impl FnMut(ColliderHandle, &'a Collider) -> bool
)
&self,
colliders: &'a ColliderSet,
point: &Point<f32, 3_usize>,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>,
callback: impl FnMut(ColliderHandle, &'a Collider) -> bool
)
Find all the colliders containing the given point.
Parameters
colliders
- The set of colliders taking part in this pipeline.point
- The point used for the containment test.query_groups
- the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
- a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.callback
- A function called with each collider with a shape containing thepoint
.
pub fn project_point_and_get_feature(
&self,
colliders: &ColliderSet,
point: &Point<f32, 3_usize>,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, PointProjection, FeatureId)>
&self,
colliders: &ColliderSet,
point: &Point<f32, 3_usize>,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> 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
colliders
- The set of colliders taking part in this pipeline.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).query_groups
- the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
- a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.
pub fn colliders_with_aabb_intersecting_aabb(
&self,
aabb: &AABB,
callback: impl FnMut(&ColliderHandle) -> bool
)
&self,
aabb: &AABB,
callback: impl FnMut(&ColliderHandle) -> bool
)
Finds all handles of all the colliders with an AABB intersecting the given AABB.
pub fn cast_shape(
&self,
colliders: &'a ColliderSet,
shape_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>,
shape_vel: &Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>,
shape: &(dyn Shape + 'static),
max_toi: f32,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, TOI)>
&self,
colliders: &'a ColliderSet,
shape_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>,
shape_vel: &Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>,
shape: &(dyn Shape + 'static),
max_toi: f32,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, TOI)>
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
- The set of colliders taking part in this pipeline.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.max_toi
- The maximum time-of-impact that can be reported by this cast. This effectively limits the distance traveled by the shape toshapeVel.norm() * maxToi
.query_groups
- the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
- a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.
pub fn nonlinear_cast_shape(
&self,
colliders: &ColliderSet,
shape_motion: &NonlinearRigidMotion,
shape: &(dyn Shape + 'static),
start_time: f32,
end_time: f32,
stop_at_penetration: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, TOI)>
&self,
colliders: &ColliderSet,
shape_motion: &NonlinearRigidMotion,
shape: &(dyn Shape + 'static),
start_time: f32,
end_time: f32,
stop_at_penetration: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>
) -> Option<(ColliderHandle, TOI)>
Casts a shape with an arbitrary continuous motion and retrieve the first collider it hits.
Parameters
colliders
- The set of colliders taking part in this pipeline.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 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.query_groups
- the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
- a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.
pub fn intersections_with_shape<'a>(
&self,
colliders: &'a ColliderSet,
shape_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>,
shape: &(dyn Shape + 'static),
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>,
callback: impl FnMut(ColliderHandle, &'a Collider) -> bool
)
&self,
colliders: &'a ColliderSet,
shape_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>,
shape: &(dyn Shape + 'static),
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle, &Collider)>,
callback: impl FnMut(ColliderHandle, &'a Collider) -> bool
)
Retrieve all the colliders intersecting the given shape.
Parameters
colliders
- The set of colliders taking part in this pipeline.shapePos
- The position of the shape to test.shapeRot
- The orientation of the shape to test.shape
- The shape to test.query_groups
- the interaction groups which will be tested against the collider’scontact_group
to determine if it should be taken into account by this query.filter
- a more fine-grained filter. A collider is taken into account by this query if itscontact_group
is compatible with thequery_groups
, and if thisfilter
is eitherNone
or returnstrue
.callback
- A function called with the handles of each collider intersecting theshape
.
Trait Implementations
impl Clone for QueryPipeline
pub fn clone(&self) -> QueryPipeline
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for QueryPipeline
pub fn default() -> QueryPipeline
Auto Trait Implementations
impl !RefUnwindSafe for QueryPipeline
impl Send for QueryPipeline
impl Sync for QueryPipeline
impl Unpin for QueryPipeline
impl !UnwindSafe for QueryPipeline
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Any + Clone,
T: Any + Clone,
impl<T> Component for T where
T: 'static + Send + Sync,
T: 'static + Send + Sync,
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> Downcast<T> for T
impl<T> DowncastSync for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<T> From<T> for T
[src]
impl<T> FromWorld for T where
T: Default,
T: Default,
pub fn from_world(_world: &mut World) -> T
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
T: 'static + Send + Sync + Clone,
pub fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>
impl<T> Upcast<T> for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,