Struct rapier2d::pipeline::QueryPipeline [−][src]
pub struct QueryPipeline { /* fields omitted */ }
Expand description
A pipeline for performing queries on all the colliders of a scene.
Implementations
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.
The query dispatcher used by this query pipeline for running scene queries.
pub fn update(
&mut self,
islands: &IslandManager,
bodies: &RigidBodySet,
colliders: &ColliderSet
)
[src]
pub fn update(
&mut self,
islands: &IslandManager,
bodies: &RigidBodySet,
colliders: &ColliderSet
)
[src]Update the acceleration structure on the query pipeline.
pub fn update_generic<Bodies, Colliders>(
&mut self,
islands: &IslandManager,
bodies: &Bodies,
colliders: &Colliders
) where
Bodies: ComponentSet<RigidBodyPosition> + ComponentSet<RigidBodyColliders> + ComponentSet<RigidBodyVelocity> + ComponentSet<RigidBodyMassProps> + ComponentSet<RigidBodyForces>,
Colliders: ComponentSet<ColliderShape> + ComponentSet<ColliderPosition> + ComponentSetOption<ColliderParent>,
[src]
pub fn update_generic<Bodies, Colliders>(
&mut self,
islands: &IslandManager,
bodies: &Bodies,
colliders: &Colliders
) where
Bodies: ComponentSet<RigidBodyPosition> + ComponentSet<RigidBodyColliders> + ComponentSet<RigidBodyVelocity> + ComponentSet<RigidBodyMassProps> + ComponentSet<RigidBodyForces>,
Colliders: ComponentSet<ColliderShape> + ComponentSet<ColliderPosition> + ComponentSetOption<ColliderParent>,
[src]Update the acceleration structure on the query pipeline.
pub fn update_with_mode<Bodies, Colliders>(
&mut self,
islands: &IslandManager,
bodies: &Bodies,
colliders: &Colliders,
mode: QueryPipelineMode
) where
Bodies: ComponentSet<RigidBodyPosition> + ComponentSet<RigidBodyColliders> + ComponentSet<RigidBodyVelocity> + ComponentSet<RigidBodyMassProps> + ComponentSet<RigidBodyForces>,
Colliders: ComponentSet<ColliderShape> + ComponentSet<ColliderPosition> + ComponentSetOption<ColliderParent>,
[src]
pub fn update_with_mode<Bodies, Colliders>(
&mut self,
islands: &IslandManager,
bodies: &Bodies,
colliders: &Colliders,
mode: QueryPipelineMode
) where
Bodies: ComponentSet<RigidBodyPosition> + ComponentSet<RigidBodyColliders> + ComponentSet<RigidBodyVelocity> + ComponentSet<RigidBodyMassProps> + ComponentSet<RigidBodyForces>,
Colliders: ComponentSet<ColliderShape> + ComponentSet<ColliderPosition> + ComponentSetOption<ColliderParent>,
[src]Update the acceleration structure on the query pipeline.
pub fn cast_ray<Colliders>(
&self,
colliders: &Colliders,
ray: &Ray,
max_toi: Real,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, Real)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn cast_ray<Colliders>(
&self,
colliders: &Colliders,
ray: &Ray,
max_toi: Real,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, Real)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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<Colliders>(
&self,
colliders: &Colliders,
ray: &Ray,
max_toi: Real,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, RayIntersection)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn cast_ray_and_get_normal<Colliders>(
&self,
colliders: &Colliders,
ray: &Ray,
max_toi: Real,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, RayIntersection)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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, Colliders>(
&self,
colliders: &'a Colliders,
ray: &Ray,
max_toi: Real,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>,
callback: impl FnMut(ColliderHandle, RayIntersection) -> bool
) where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn intersections_with_ray<'a, Colliders>(
&self,
colliders: &'a Colliders,
ray: &Ray,
max_toi: Real,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>,
callback: impl FnMut(ColliderHandle, RayIntersection) -> bool
) where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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<Colliders>(
&self,
colliders: &Colliders,
shape_pos: &Isometry<Real>,
shape: &dyn Shape,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<ColliderHandle> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn intersection_with_shape<Colliders>(
&self,
colliders: &Colliders,
shape_pos: &Isometry<Real>,
shape: &dyn Shape,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<ColliderHandle> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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<Colliders>(
&self,
colliders: &Colliders,
point: &Point<Real>,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, PointProjection)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn project_point<Colliders>(
&self,
colliders: &Colliders,
point: &Point<Real>,
solid: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, PointProjection)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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, Colliders>(
&self,
colliders: &'a Colliders,
point: &Point<Real>,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>,
callback: impl FnMut(ColliderHandle) -> bool
) where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn intersections_with_point<'a, Colliders>(
&self,
colliders: &'a Colliders,
point: &Point<Real>,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>,
callback: impl FnMut(ColliderHandle) -> bool
) where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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<Colliders>(
&self,
colliders: &Colliders,
point: &Point<Real>,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, PointProjection, FeatureId)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn project_point_and_get_feature<Colliders>(
&self,
colliders: &Colliders,
point: &Point<Real>,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, PointProjection, FeatureId)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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
)
[src]
pub fn colliders_with_aabb_intersecting_aabb(
&self,
aabb: &AABB,
callback: impl FnMut(&ColliderHandle) -> bool
)
[src]Finds all handles of all the colliders with an AABB intersecting the given AABB.
pub fn cast_shape<'a, Colliders>(
&self,
colliders: &'a Colliders,
shape_pos: &Isometry<Real>,
shape_vel: &Vector<Real>,
shape: &dyn Shape,
max_toi: Real,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, TOI)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn cast_shape<'a, Colliders>(
&self,
colliders: &'a Colliders,
shape_pos: &Isometry<Real>,
shape_vel: &Vector<Real>,
shape: &dyn Shape,
max_toi: Real,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, TOI)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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<Colliders>(
&self,
colliders: &Colliders,
shape_motion: &NonlinearRigidMotion,
shape: &dyn Shape,
start_time: Real,
end_time: Real,
stop_at_penetration: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, TOI)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn nonlinear_cast_shape<Colliders>(
&self,
colliders: &Colliders,
shape_motion: &NonlinearRigidMotion,
shape: &dyn Shape,
start_time: Real,
end_time: Real,
stop_at_penetration: bool,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>
) -> Option<(ColliderHandle, TOI)> where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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, Colliders>(
&self,
colliders: &'a Colliders,
shape_pos: &Isometry<Real>,
shape: &dyn Shape,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>,
callback: impl FnMut(ColliderHandle) -> bool
) where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]
pub fn intersections_with_shape<'a, Colliders>(
&self,
colliders: &'a Colliders,
shape_pos: &Isometry<Real>,
shape: &dyn Shape,
query_groups: InteractionGroups,
filter: Option<&dyn Fn(ColliderHandle) -> bool>,
callback: impl FnMut(ColliderHandle) -> bool
) where
Colliders: ComponentSet<ColliderFlags> + ComponentSet<ColliderPosition> + ComponentSet<ColliderShape>,
[src]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
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
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
type Output = T
type Output = T
Should always be Self
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
Checks if self
is actually part of its subset T
(and can be converted to it).
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
The inclusion map: converts self
to the equivalent element of its superset.