Skip to main content

EntityOverlapQueries

Struct EntityOverlapQueries 

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<'a> Clone for EntityOverlapQueries<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for EntityOverlapQueries<'a>

Source§

impl<'a> Debug for EntityOverlapQueries<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.