pub struct NarrowPhase;Implementations§
Source§impl NarrowPhase
impl NarrowPhase
Sourcepub fn sphere_sphere(
pos_a: Vec3,
r_a: f32,
pos_b: Vec3,
r_b: f32,
) -> Option<ContactPoint>
pub fn sphere_sphere( pos_a: Vec3, r_a: f32, pos_b: Vec3, r_b: f32, ) -> Option<ContactPoint>
Sphere–Sphere. Normal points from A toward B.
Sourcepub fn sphere_plane(
sph_pos: Vec3,
r: f32,
plane_n: Vec3,
plane_d: f32,
) -> Option<ContactPoint>
pub fn sphere_plane( sph_pos: Vec3, r: f32, plane_n: Vec3, plane_d: f32, ) -> Option<ContactPoint>
Sphere–Plane. n is the plane normal (points away from the solid
half-space); d is the signed plane offset (p·n = d).
Normal in the returned contact points from the sphere toward the
plane (i.e. into the plane — same convention: A → B where A = sphere).
Sourcepub fn box_plane(
bpos: Vec3,
brot: Quat,
half: Vec3,
plane_n: Vec3,
plane_d: f32,
) -> Vec<ContactPoint>
pub fn box_plane( bpos: Vec3, brot: Quat, half: Vec3, plane_n: Vec3, plane_d: f32, ) -> Vec<ContactPoint>
Box–Plane contact. Returns up to 4 corner contacts (one per
penetrating corner). Normal in each contact points from the box toward
the plane (-plane_n).
Sourcepub fn shape_plane(
shape: &ColliderShape,
pos: Vec3,
rot: Quat,
plane_n: Vec3,
plane_d: f32,
) -> Option<ContactPoint>
pub fn shape_plane( shape: &ColliderShape, pos: Vec3, rot: Quat, plane_n: Vec3, plane_d: f32, ) -> Option<ContactPoint>
Generic shape–plane using a GJK support point. Returns at most one contact (the deepest support point against the plane).
Sourcepub fn box_box(
pos_a: Vec3,
rot_a: Quat,
ha: Vec3,
pos_b: Vec3,
rot_b: Quat,
hb: Vec3,
) -> Vec<ContactPoint>
pub fn box_box( pos_a: Vec3, rot_a: Quat, ha: Vec3, pos_b: Vec3, rot_b: Quat, hb: Vec3, ) -> Vec<ContactPoint>
Box–Box via the Separating Axis Theorem (15 axes) followed by Sutherland–Hodgman clipping to produce up to 4 contact points.
Returns an empty Vec when the boxes do not overlap.
Sourcepub fn test_collision(
shape_a: &ColliderShape,
pos_a: Vec3,
rot_a: Quat,
shape_b: &ColliderShape,
pos_b: Vec3,
rot_b: Quat,
) -> Option<ContactPoint>
pub fn test_collision( shape_a: &ColliderShape, pos_a: Vec3, rot_a: Quat, shape_b: &ColliderShape, pos_b: Vec3, rot_b: Quat, ) -> Option<ContactPoint>
Return the single deepest contact between two shapes, or None if
they do not overlap.
Use this for simple overlap queries or soft-body node tests. For
rigid-body simulation prefer [test_collision_manifold] which can
return multiple contact points.
Sourcepub fn test_collision_manifold(
shape_a: &ColliderShape,
pos_a: Vec3,
rot_a: Quat,
shape_b: &ColliderShape,
pos_b: Vec3,
rot_b: Quat,
) -> Vec<ContactPoint>
pub fn test_collision_manifold( shape_a: &ColliderShape, pos_a: Vec3, rot_a: Quat, shape_b: &ColliderShape, pos_b: Vec3, rot_b: Quat, ) -> Vec<ContactPoint>
Return up to 4 contact points between two shapes.
Compound shapes are handled recursively; each sub-shape pair is dispatched independently and all resulting contacts are collected.
Auto Trait Implementations§
impl Freeze for NarrowPhase
impl RefUnwindSafe for NarrowPhase
impl Send for NarrowPhase
impl Sync for NarrowPhase
impl Unpin for NarrowPhase
impl UnsafeUnpin for NarrowPhase
impl UnwindSafe for NarrowPhase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more