Trait rhusics_core::NarrowPhase
source · pub trait NarrowPhase<P, T, B, Y = ()>: Sendwhere
P: Primitive,
<P::Point as EuclideanSpace>::Diff: Debug,{
fn collide(
&self,
left: &CollisionShape<P, T, B, Y>,
left_transform: &T,
right: &CollisionShape<P, T, B, Y>,
right_transform: &T
) -> Option<Contact<P::Point>>;
fn collide_continuous(
&self,
left: &CollisionShape<P, T, B, Y>,
left_start_transform: &T,
left_end_transform: Option<&T>,
right: &CollisionShape<P, T, B, Y>,
right_start_transform: &T,
right_end_transform: Option<&T>
) -> Option<Contact<P::Point>>;
}
Expand description
Base trait implemented by all narrow phase algorithms.
Type parameters:
P
: collision primitive typeT
: model-to-world transform typeB
: Bounding volumeY
: Shape type (seeCollider
)
Required Methods
sourcefn collide(
&self,
left: &CollisionShape<P, T, B, Y>,
left_transform: &T,
right: &CollisionShape<P, T, B, Y>,
right_transform: &T
) -> Option<Contact<P::Point>>
fn collide(
&self,
left: &CollisionShape<P, T, B, Y>,
left_transform: &T,
right: &CollisionShape<P, T, B, Y>,
right_transform: &T
) -> Option<Contact<P::Point>>
Check if two shapes collides, and give a contact manifold for the contact with the largest penetration depth.
Parameters:
left
: the left shapeleft_transform
: model-to-world transform for the left shaperight
: the right shaperight_transform
: model-to-world transform for the right shape
Returns:
Optionally returns the contact manifold for the contact with largest penetration depth
sourcefn collide_continuous(
&self,
left: &CollisionShape<P, T, B, Y>,
left_start_transform: &T,
left_end_transform: Option<&T>,
right: &CollisionShape<P, T, B, Y>,
right_start_transform: &T,
right_end_transform: Option<&T>
) -> Option<Contact<P::Point>>
fn collide_continuous(
&self,
left: &CollisionShape<P, T, B, Y>,
left_start_transform: &T,
left_end_transform: Option<&T>,
right: &CollisionShape<P, T, B, Y>,
right_start_transform: &T,
right_end_transform: Option<&T>
) -> Option<Contact<P::Point>>
Check if two shapes collides along the given transformation paths, and give a contact manifold for the contact with the earliest time of impact.
Will only use continuous detection if one of the shapes have Continuous
collision mode.
Parameters:
left
: the left shapeleft_start_transform
: model-to-world transform for the left shape, at start of frameleft_end_transform
: model-to-world transform for the left shape, at end of frameright
: the right shaperight_start_transform
: model-to-world transform for the right shape, at start of frameright_end_transform
: model-to-world transform for the right shape, at end of frame
Returns:
Optionally returns the contact manifold for the contact with largest penetration depth