pub struct Contacts {
pub entity1: Entity,
pub entity2: Entity,
pub body_entity1: Option<Entity>,
pub body_entity2: Option<Entity>,
pub manifolds: Vec<ContactManifold>,
pub is_sensor: bool,
pub during_current_frame: bool,
pub during_previous_frame: bool,
pub total_normal_impulse: Scalar,
pub total_tangent_impulse: Vector2,
}
Expand description
All contacts between two colliders.
The contacts are stored in contact manifolds. Each manifold contains one or more contact points, and each contact in a given manifold shares the same contact normal.
Fields§
§entity1: Entity
First entity in the contact.
entity2: Entity
Second entity in the contact.
body_entity1: Option<Entity>
The entity of the first body involved in the contact.
body_entity2: Option<Entity>
The entity of the second body involved in the contact.
manifolds: Vec<ContactManifold>
A list of contact manifolds between two colliders. Each manifold contains one or more contact points, but each contact in a given manifold shares the same contact normal.
is_sensor: bool
True if either of the colliders involved is a sensor.
during_current_frame: bool
True if the bodies have been in contact during this frame.
during_previous_frame: bool
True if the bodies were in contact during the previous frame.
total_normal_impulse: Scalar
The total normal impulse applied to the first body in a collision.
To get the corresponding force, divide the impulse by Time<Substeps>::delta_seconds()
.
total_tangent_impulse: Vector2
The total tangent impulse applied to the first body in a collision.
To get the corresponding force, divide the impulse by Time<Substeps>::delta_seconds()
.
Implementations§
source§impl Contacts
impl Contacts
sourcepub fn total_normal_force(&self, delta_time: Scalar) -> Scalar
pub fn total_normal_force(&self, delta_time: Scalar) -> Scalar
The force corresponding to the total normal impulse applied over delta_time
.
Because contacts are solved over several substeps, delta_time
should
typically use Time<Substeps>::delta_seconds()
.
sourcepub fn total_tangent_force(&self, delta_time: Scalar) -> Vector2
pub fn total_tangent_force(&self, delta_time: Scalar) -> Vector2
The force corresponding to the total tangent impulse applied over delta_time
.
Because contacts are solved over several substeps, delta_time
should
typically use Time<Substeps>::delta_seconds()
.
Trait Implementations§
source§impl PartialEq for Contacts
impl PartialEq for Contacts
impl StructuralPartialEq for Contacts
Auto Trait Implementations§
impl Freeze for Contacts
impl RefUnwindSafe for Contacts
impl Send for Contacts
impl Sync for Contacts
impl Unpin for Contacts
impl UnwindSafe for Contacts
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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<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 moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.