Trait ncollide2d::narrow_phase::NarrowPhase
source · pub trait NarrowPhase<N: Real, T>: Any + Send + Sync {
fn update(
&mut self,
objects: &CollisionObjectSlab<N, T>,
contact_events: &mut ContactEvents,
proximity_events: &mut ProximityEvents,
timestamp: usize
);
fn handle_interaction(
&mut self,
contact_signal: &mut ContactEvents,
proximity_signal: &mut ProximityEvents,
objects: &CollisionObjectSlab<N, T>,
handle1: CollisionObjectHandle,
handle2: CollisionObjectHandle,
started: bool
);
fn handle_removal(
&mut self,
objects: &CollisionObjectSlab<N, T>,
handle1: CollisionObjectHandle,
handle2: CollisionObjectHandle
);
fn contact_pair(
&self,
handle1: CollisionObjectHandle,
handle2: CollisionObjectHandle
) -> Option<&ContactAlgorithm<N>>;
fn contact_pairs<'a>(
&'a self,
objects: &'a CollisionObjectSlab<N, T>
) -> ContactPairs<'a, N, T> ⓘ;
fn proximity_pairs<'a>(
&'a self,
objects: &'a CollisionObjectSlab<N, T>
) -> ProximityPairs<'a, N, T> ⓘ;
}
Expand description
Trait implemented by the narrow phase manager.
The narrow phase manager is responsible for creating, updating and generating contact pairs between objects identified by the broad phase.
Required Methods§
sourcefn update(
&mut self,
objects: &CollisionObjectSlab<N, T>,
contact_events: &mut ContactEvents,
proximity_events: &mut ProximityEvents,
timestamp: usize
)
fn update(
&mut self,
objects: &CollisionObjectSlab<N, T>,
contact_events: &mut ContactEvents,
proximity_events: &mut ProximityEvents,
timestamp: usize
)
Updates this narrow phase.
sourcefn handle_interaction(
&mut self,
contact_signal: &mut ContactEvents,
proximity_signal: &mut ProximityEvents,
objects: &CollisionObjectSlab<N, T>,
handle1: CollisionObjectHandle,
handle2: CollisionObjectHandle,
started: bool
)
fn handle_interaction(
&mut self,
contact_signal: &mut ContactEvents,
proximity_signal: &mut ProximityEvents,
objects: &CollisionObjectSlab<N, T>,
handle1: CollisionObjectHandle,
handle2: CollisionObjectHandle,
started: bool
)
Called when the broad phase detects that two objects are, or stop to be, in close proximity.
sourcefn handle_removal(
&mut self,
objects: &CollisionObjectSlab<N, T>,
handle1: CollisionObjectHandle,
handle2: CollisionObjectHandle
)
fn handle_removal(
&mut self,
objects: &CollisionObjectSlab<N, T>,
handle1: CollisionObjectHandle,
handle2: CollisionObjectHandle
)
Called when the interactions between two objects have to be removed because at least one of the objects is being removed.
While either objects[handle1]
or objects[handle2]
is being removed, the handle_removal
is assumed to be called before the removal from the list objects
is done.
sourcefn contact_pair(
&self,
handle1: CollisionObjectHandle,
handle2: CollisionObjectHandle
) -> Option<&ContactAlgorithm<N>>
fn contact_pair(
&self,
handle1: CollisionObjectHandle,
handle2: CollisionObjectHandle
) -> Option<&ContactAlgorithm<N>>
Retrieve the contact pair for the given two objects.
Retruns None
if no pairs is available for those two objects.
sourcefn contact_pairs<'a>(
&'a self,
objects: &'a CollisionObjectSlab<N, T>
) -> ContactPairs<'a, N, T> ⓘ
fn contact_pairs<'a>(
&'a self,
objects: &'a CollisionObjectSlab<N, T>
) -> ContactPairs<'a, N, T> ⓘ
Returns all the potential contact pairs found during the broad phase, and validated by the narrow phase.
sourcefn proximity_pairs<'a>(
&'a self,
objects: &'a CollisionObjectSlab<N, T>
) -> ProximityPairs<'a, N, T> ⓘ
fn proximity_pairs<'a>(
&'a self,
objects: &'a CollisionObjectSlab<N, T>
) -> ProximityPairs<'a, N, T> ⓘ
Returns all the potential proximity pairs found during the broad phase, and validated by the narrow phase.