[−][src]Trait nphysics3d::object::ColliderSet
Trait implemented by sets of colliders.
A set of colliders maps a collider handle to a collider instance. In addition, it must maintain a set of
data related to colliders that have been inserted or removed (see the pop_insertion_event
and pop_removal_event
methods for details).
Associated Types
type Handle: ColliderHandle
[src]
Type of a collider handle identifying a collider in this set.
Required methods
pub fn get(&self, handle: Self::Handle) -> Option<&Collider<N, Handle>>
[src]
Gets a reference to the collider identified by handle
.
pub fn get_mut(
&mut self,
handle: Self::Handle
) -> Option<&mut Collider<N, Handle>>
[src]
&mut self,
handle: Self::Handle
) -> Option<&mut Collider<N, Handle>>
Gets a mutable reference to the collider identified by handle
.
pub fn contains(&self, handle: Self::Handle) -> bool
[src]
Check if this set contains a collider identified by handle
.
pub fn foreach(&self, f: impl FnMut(Self::Handle, &Collider<N, Handle>))
[src]
Iterate through all the colliders on this set, applying the closure f
on them.
pub fn foreach_mut(
&mut self,
f: impl FnMut(Self::Handle, &mut Collider<N, Handle>)
)
[src]
&mut self,
f: impl FnMut(Self::Handle, &mut Collider<N, Handle>)
)
Mutable iterates through all the colliders on this set, applying the closure f
on them.
pub fn pop_insertion_event(&mut self) -> Option<Self::Handle>
[src]
Gets the handle of one collider that has been inserted.
A collider set must keep track (using typically a stack or a queue) of every collider that has been inserted from it. This is used by nphysics to perform some internal setup actions, or physical actions like waking colliders touching one that has been inserted.
This method should return a removed collider handle only once.
pub fn pop_removal_event(
&mut self
) -> Option<(Self::Handle, ColliderRemovalData<N, Handle>)>
[src]
&mut self
) -> Option<(Self::Handle, ColliderRemovalData<N, Handle>)>
Gets the handle and removal data of one collider that has been removed.
A collider set must keep track (using typically a stack or a queue) of every collider that has been removed from it. This is used by nphysics to perform some internal cleanup actions, or physical actions like waking colliders touching one that has been removed.
This method should return a removed collider handle and its associated ColliderRemovalData
only once.
pub fn remove(
&mut self,
to_remove: Self::Handle
) -> Option<&mut ColliderRemovalData<N, Handle>>
[src]
&mut self,
to_remove: Self::Handle
) -> Option<&mut ColliderRemovalData<N, Handle>>
Removes a collider from this set.
A collider can be removed automatically by nphysics when the collider it was attached too has been removed.
Provided methods
pub fn get_pair(
&self,
handle1: Self::Handle,
handle2: Self::Handle
) -> (Option<&Collider<N, Handle>>, Option<&Collider<N, Handle>>)
[src]
&self,
handle1: Self::Handle,
handle2: Self::Handle
) -> (Option<&Collider<N, Handle>>, Option<&Collider<N, Handle>>)
Gets a reference to the two colliders identified by handle1
and handle2
.
Both handles are allowed to be equal.
Implementors
impl<N: RealField, Handle: BodyHandle> ColliderSet<N, Handle> for DefaultColliderSet<N, Handle>
[src]
type Handle = DefaultColliderHandle
pub fn get(&self, handle: Self::Handle) -> Option<&Collider<N, Handle>>
[src]
pub fn get_mut(
&mut self,
handle: Self::Handle
) -> Option<&mut Collider<N, Handle>>
[src]
&mut self,
handle: Self::Handle
) -> Option<&mut Collider<N, Handle>>
pub fn contains(&self, handle: Self::Handle) -> bool
[src]
pub fn foreach(&self, f: impl FnMut(Self::Handle, &Collider<N, Handle>))
[src]
pub fn foreach_mut(
&mut self,
f: impl FnMut(Self::Handle, &mut Collider<N, Handle>)
)
[src]
&mut self,
f: impl FnMut(Self::Handle, &mut Collider<N, Handle>)
)
pub fn pop_insertion_event(&mut self) -> Option<Self::Handle>
[src]
pub fn pop_removal_event(
&mut self
) -> Option<(Self::Handle, ColliderRemovalData<N, Handle>)>
[src]
&mut self
) -> Option<(Self::Handle, ColliderRemovalData<N, Handle>)>
pub fn remove(
&mut self,
to_remove: Self::Handle
) -> Option<&mut ColliderRemovalData<N, Handle>>
[src]
&mut self,
to_remove: Self::Handle
) -> Option<&mut ColliderRemovalData<N, Handle>>