Struct nphysics2d::world::GeometricalWorld [−][src]
pub struct GeometricalWorld<N: RealField + Copy, Handle: BodyHandle, CollHandle: ColliderHandle> { /* fields omitted */ }
Expand description
The world managing all geometric queries.
This is a wrapper over the CollisionWorld
structure from ncollide
to simplify
its use with the [object::Collider] structure.
Implementations
impl<N: RealField + Copy, Handle: BodyHandle, CollHandle: ColliderHandle> GeometricalWorld<N, Handle, CollHandle>
impl<N: RealField + Copy, Handle: BodyHandle, CollHandle: ColliderHandle> GeometricalWorld<N, Handle, CollHandle>
pub fn from_parts<BF>(
broad_phase: BF,
narrow_phase: NarrowPhase<N, CollHandle>
) -> Self where
BF: BroadPhase<N, AABB<N>, CollHandle>,
pub fn from_parts<BF>(
broad_phase: BF,
narrow_phase: NarrowPhase<N, CollHandle>
) -> Self where
BF: BroadPhase<N, AABB<N>, CollHandle>,
Creates a geometrical world from the provided broad-phase and narrow-phase structures.
pub fn maintain<Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&mut self,
bodies: &mut dyn BodySet<N, Handle = Handle>,
colliders: &mut Colliders
)
pub fn maintain<Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&mut self,
bodies: &mut dyn BodySet<N, Handle = Handle>,
colliders: &mut Colliders
)
Maintain the internal structures of the geometrical world by handling body removals and colliders insersion and removals.
pub fn sync_colliders<Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&mut self,
bodies: &dyn BodySet<N, Handle = Handle>,
colliders: &mut Colliders
)
pub fn sync_colliders<Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&mut self,
bodies: &dyn BodySet<N, Handle = Handle>,
colliders: &mut Colliders
)
Synchronize all colliders with their body parent and the underlying collision world.
Returns the set of colliders attached to the specified body.
Returns None
if the body has no collider attached to it, of if the body does not exist.
Empty the contact and proximity event pools.
pub fn perform_broad_phase<Bodies, Colliders, Filter: ?Sized>(
&mut self,
bodies: &Bodies,
colliders: &Colliders,
user_filter: &Filter
) where
Bodies: BodySet<N, Handle = Handle>,
Colliders: ColliderSet<N, Handle, Handle = CollHandle>,
Filter: for<'a> BroadPhasePairFilter<N, BroadPhasePairFilterSets<'a, N, Bodies, Colliders>> + ?Sized,
pub fn perform_broad_phase<Bodies, Colliders, Filter: ?Sized>(
&mut self,
bodies: &Bodies,
colliders: &Colliders,
user_filter: &Filter
) where
Bodies: BodySet<N, Handle = Handle>,
Colliders: ColliderSet<N, Handle, Handle = CollHandle>,
Filter: for<'a> BroadPhasePairFilter<N, BroadPhasePairFilterSets<'a, N, Bodies, Colliders>> + ?Sized,
Executes the broad phase of the collision detection pipeline.
pub fn perform_narrow_phase<Colliders>(&mut self, colliders: &Colliders) where
Colliders: ColliderSet<N, Handle, Handle = CollHandle>,
pub fn perform_narrow_phase<Colliders>(&mut self, colliders: &Colliders) where
Colliders: ColliderSet<N, Handle, Handle = CollHandle>,
Executes the narrow phase of the collision detection pipeline.
The broad-phase used by this geometrical world.
pub fn interferences_with_ray<'a, 'b, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
ray: &'b Ray<N>,
max_toi: N,
groups: &'b CollisionGroups
) -> InterferencesWithRay<'a, 'b, N, Colliders>
pub fn interferences_with_ray<'a, 'b, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
ray: &'b Ray<N>,
max_toi: N,
groups: &'b CollisionGroups
) -> InterferencesWithRay<'a, 'b, N, Colliders>
Computes the interferences between every rigid bodies on this world and a ray.
pub fn interferences_with_point<'a, 'b, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
point: &'b Point<N>,
groups: &'b CollisionGroups
) -> InterferencesWithPoint<'a, 'b, N, Colliders>
pub fn interferences_with_point<'a, 'b, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
point: &'b Point<N>,
groups: &'b CollisionGroups
) -> InterferencesWithPoint<'a, 'b, N, Colliders>
Computes the interferences between every rigid bodies of a given broad phase, and a point.
pub fn interferences_with_aabb<'a, 'b, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
aabb: &'b AABB<N>,
groups: &'b CollisionGroups
) -> InterferencesWithAABB<'a, 'b, N, Colliders>
pub fn interferences_with_aabb<'a, 'b, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
aabb: &'b AABB<N>,
groups: &'b CollisionGroups
) -> InterferencesWithAABB<'a, 'b, N, Colliders>
Computes the interferences between every rigid bodies of a given broad phase, and a aabb.
The contact events pool.
The proximity events pool.
pub fn interaction_pairs<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
effective_only: bool
) -> impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a Interaction<N>)>
pub fn interaction_pairs<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
effective_only: bool
) -> impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a Interaction<N>)>
All the potential interactions pairs.
Refer to the official user guide for details.
pub fn contact_pairs<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
effective_only: bool
) -> impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a ContactAlgorithm<N>, &'a ContactManifold<N>)>
pub fn contact_pairs<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
effective_only: bool
) -> impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a ContactAlgorithm<N>, &'a ContactManifold<N>)>
All the potential contact pairs.
Refer to the official user guide for details.
pub fn proximity_pairs<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
effective_only: bool
) -> impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a dyn ProximityDetector<N>, Proximity)>
pub fn proximity_pairs<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
effective_only: bool
) -> impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a dyn ProximityDetector<N>, Proximity)>
All the potential proximity pairs.
Refer to the official user guide for details.
pub fn interaction_pair<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle1: CollHandle,
handle2: CollHandle,
effective_only: bool
) -> Option<(CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a Interaction<N>)>
pub fn interaction_pair<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle1: CollHandle,
handle2: CollHandle,
effective_only: bool
) -> Option<(CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a Interaction<N>)>
The potential interaction pair between the two specified colliders.
Refer to the official user guide for details.
pub fn contact_pair<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle1: CollHandle,
handle2: CollHandle,
effective_only: bool
) -> Option<(CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a ContactAlgorithm<N>, &'a ContactManifold<N>)>
pub fn contact_pair<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle1: CollHandle,
handle2: CollHandle,
effective_only: bool
) -> Option<(CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a ContactAlgorithm<N>, &'a ContactManifold<N>)>
The potential contact pair between the two specified colliders.
Refer to the official user guide for details.
pub fn proximity_pair<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle1: CollHandle,
handle2: CollHandle,
effective_only: bool
) -> Option<(CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a dyn ProximityDetector<N>, Proximity)>
pub fn proximity_pair<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle1: CollHandle,
handle2: CollHandle,
effective_only: bool
) -> Option<(CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a dyn ProximityDetector<N>, Proximity)>
The potential proximity pair between the two specified colliders.
Refer to the official user guide for details.
pub fn interactions_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle,
effective_only: bool
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a Interaction<N>)>>
pub fn interactions_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle,
effective_only: bool
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a Interaction<N>)>>
All the interaction pairs involving the specified collider.
Refer to the official user guide for details.
pub fn contacts_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle,
effective_only: bool
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a ContactAlgorithm<N>, &'a ContactManifold<N>)>>
pub fn contacts_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle,
effective_only: bool
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a ContactAlgorithm<N>, &'a ContactManifold<N>)>>
All the contact pairs involving the specified collider.
Refer to the official user guide for details.
pub fn proximities_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle,
effective_only: bool
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a dyn ProximityDetector<N>, Proximity)>>
pub fn proximities_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle,
effective_only: bool
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>, CollHandle, &'a Collider<N, Handle>, &'a dyn ProximityDetector<N>, Proximity)>>
All the proximity pairs involving the specified collider.
Refer to the official user guide for details.
pub fn colliders_interacting_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>)>>
pub fn colliders_interacting_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>)>>
All the collider handles of colliders interacting with the specified collider.
Refer to the official user guide for details.
pub fn colliders_in_contact_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>)>>
pub fn colliders_in_contact_with<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>)>>
All the collider handles of colliders in potential contact with the specified collision object.
Refer to the official user guide for details.
pub fn colliders_in_proximity_of<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>)>>
pub fn colliders_in_proximity_of<'a, Colliders: ColliderSet<N, Handle, Handle = CollHandle>>(
&'a self,
colliders: &'a Colliders,
handle: CollHandle
) -> Option<impl Iterator<Item = (CollHandle, &'a Collider<N, Handle>)>>
All the collider handles of colliders in potential proximity of with the specified collider.
Refer to the official user guide for details.
Auto Trait Implementations
impl<N, Handle, CollHandle> !RefUnwindSafe for GeometricalWorld<N, Handle, CollHandle>
impl<N, Handle, CollHandle> Send for GeometricalWorld<N, Handle, CollHandle>
impl<N, Handle, CollHandle> Sync for GeometricalWorld<N, Handle, CollHandle>
impl<N, Handle, CollHandle> Unpin for GeometricalWorld<N, Handle, CollHandle> where
CollHandle: Unpin,
Handle: Unpin,
N: Unpin,
impl<N, Handle, CollHandle> !UnwindSafe for GeometricalWorld<N, Handle, CollHandle>
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.