pub struct EntityOverlapQueries<'a> { /* private fields */ }Expand description
Read-only overlap queries by entity, against a broadphase already built.
PhysicsSystem::overlap_queries is the only thing that makes one, and it
takes &mut PhysicsSystem to build the tree before handing back this shared
borrow — so the tree is current for as long as this exists, and nothing can
move a body while it does. crate::world::OverlapQueries carries the full
argument; the difference here is only that the hits come back as entities.
This is what a par_for over a crowd captures. It is Copy and Sync,
every chunk queries through the same one, and each chunk brings a
QueryScratch of its own.
Implementations§
Source§impl EntityOverlapQueries<'_>
impl EntityOverlapQueries<'_>
Sourcepub fn overlap_sphere_into(
&self,
centre: DVec3,
radius: f64,
scratch: &mut QueryScratch,
out: &mut Vec<(Entity, OverlapHit)>,
)
pub fn overlap_sphere_into( &self, centre: DVec3, radius: f64, scratch: &mut QueryScratch, out: &mut Vec<(Entity, OverlapHit)>, )
PhysicsSystem::overlap_sphere_into under a shared borrow, working in
scratch instead of the system’s own buffers.
out is cleared and then filled, with the same entities in the same
order the &mut self form produces — which is the property a sample
swapping one for the other depends on, and which holds because the two
share one traversal rather than because they were compared.
crcbl_phys::system::tests::the_view_names_the_right_entities_from_every_thread_at_once
checks the entities against the positions they were placed at.
Sourcepub fn overlap_sphere_filtered_into(
&self,
centre: DVec3,
radius: f64,
filter: QueryFilter,
scratch: &mut QueryScratch,
out: &mut Vec<(Entity, OverlapHit)>,
)
pub fn overlap_sphere_filtered_into( &self, centre: DVec3, radius: f64, filter: QueryFilter, scratch: &mut QueryScratch, out: &mut Vec<(Entity, OverlapHit)>, )
overlap_sphere_into naming only the
entities whose collider filter admits — see QueryFilter.
Sourcepub fn overlap_sphere_entities_into(
&self,
centre: DVec3,
radius: f64,
scratch: &mut QueryScratch,
out: &mut Vec<Entity>,
)
pub fn overlap_sphere_entities_into( &self, centre: DVec3, radius: f64, scratch: &mut QueryScratch, out: &mut Vec<Entity>, )
overlap_sphere_into naming the entities
and dropping their hits: the same entities in the same order.
The fast path for a crowd pass that never reads a hit —
OverlapQueries::overlap_sphere_ids_into says what it saves and how
that was measured.
Sourcepub fn overlap_aabb_into(
&self,
aabb: &Aabb,
scratch: &mut QueryScratch,
out: &mut Vec<Entity>,
)
pub fn overlap_aabb_into( &self, aabb: &Aabb, scratch: &mut QueryScratch, out: &mut Vec<Entity>, )
PhysicsSystem::overlap_aabb under a shared borrow, writing into a
buffer the caller owns.
out is cleared and then filled with the same entities in the same
order the &mut self form produces, because that form is this one.
It answers as PhysicsSystem::overlap_aabb does: a box, a compound
or a mesh where its shape meets aabb, a sphere or a capsule wherever
the box around it does.
Sourcepub fn overlap_aabb_filtered_into(
&self,
aabb: &Aabb,
filter: QueryFilter,
scratch: &mut QueryScratch,
out: &mut Vec<Entity>,
)
pub fn overlap_aabb_filtered_into( &self, aabb: &Aabb, filter: QueryFilter, scratch: &mut QueryScratch, out: &mut Vec<Entity>, )
overlap_aabb_into naming only the entities
whose collider filter admits — see QueryFilter.
Sourcepub fn cast_ray(
&self,
ray: &Ray,
scratch: &mut QueryScratch,
) -> Option<(Entity, ShapeHit)>
pub fn cast_ray( &self, ray: &Ray, scratch: &mut QueryScratch, ) -> Option<(Entity, ShapeHit)>
PhysicsSystem::cast_ray under a shared borrow, working in scratch
instead of the system’s own buffers.
Triggers are non-solid and are skipped, and a hit on a collider no
entity is mapped to answers None — both exactly as in the &mut self
form, which calls this one.
Sourcepub fn cast_ray_filtered(
&self,
ray: &Ray,
filter: QueryFilter,
scratch: &mut QueryScratch,
) -> Option<(Entity, ShapeHit)>
pub fn cast_ray_filtered( &self, ray: &Ray, filter: QueryFilter, scratch: &mut QueryScratch, ) -> Option<(Entity, ShapeHit)>
cast_ray over only the colliders filter admits —
see QueryFilter. Its exclusion is a ColliderId, which
PhysicsSystem::collider_of gives for an entity.
Sourcepub fn sweep_sphere(
&self,
segment: &Segment,
radius: f64,
scratch: &mut QueryScratch,
) -> Option<(Entity, ShapeHit)>
pub fn sweep_sphere( &self, segment: &Segment, radius: f64, scratch: &mut QueryScratch, ) -> Option<(Entity, ShapeHit)>
PhysicsSystem::sweep_sphere under a shared borrow, working in
scratch instead of the system’s own buffers.
Every collider in the world is a candidate, including the sweeper’s own
if it has one — there is no entity-level exclusion here, because
PhysicsSystem::sweep_body needs the body’s velocity and transform to
build its segment and this view does not carry them.
Sourcepub fn sweep_sphere_filtered(
&self,
segment: &Segment,
radius: f64,
filter: QueryFilter,
scratch: &mut QueryScratch,
) -> Option<(Entity, ShapeHit)>
pub fn sweep_sphere_filtered( &self, segment: &Segment, radius: f64, filter: QueryFilter, scratch: &mut QueryScratch, ) -> Option<(Entity, ShapeHit)>
sweep_sphere over only the colliders filter
admits — see QueryFilter. This is how a sweeper whose own entity
has a collider leaves itself out here: exclude
PhysicsSystem::collider_of it.