pub struct PenetrationConstraint {Show 13 fields
pub entity1: Entity,
pub entity2: Entity,
pub collider_entity1: Entity,
pub collider_entity2: Entity,
pub contact: ContactData,
pub manifold_index: usize,
pub r1: Vector,
pub r2: Vector,
pub normal_lagrange: Scalar,
pub tangent_lagrange: Scalar,
pub compliance: Scalar,
pub friction: Friction,
pub restitution: Restitution,
}
Expand description
A constraint between two bodies that prevents overlap with a given compliance.
A compliance of 0.0 resembles a constraint with infinite stiffness, so the bodies should not have any overlap.
Fields§
§entity1: Entity
First entity in the constraint.
entity2: Entity
Second entity in the constraint.
collider_entity1: Entity
The entity of the collider of the first body.
collider_entity2: Entity
The entity of the collider of the second body.
contact: ContactData
Data associated with the contact.
manifold_index: usize
The index of the contact in the manifold.
r1: Vector
Vector from the first entity’s center of mass to the contact point in local coordinates.
r2: Vector
Vector from the second entity’s center of mass to the contact point in local coordinates.
normal_lagrange: Scalar
Lagrange multiplier for the normal force.
tangent_lagrange: Scalar
Lagrange multiplier for the tangential force.
compliance: Scalar
The constraint’s compliance, the inverse of stiffness, has the unit meters / Newton.
friction: Friction
The effective friction of the contact.
restitution: Restitution
The effective restitution of the contact.
Implementations§
source§impl PenetrationConstraint
impl PenetrationConstraint
sourcepub fn new(
body1: &RigidBodyQueryItem<'_>,
body2: &RigidBodyQueryItem<'_>,
collider_entity1: Entity,
collider_entity2: Entity,
contact: ContactData,
manifold_index: usize
) -> Self
pub fn new( body1: &RigidBodyQueryItem<'_>, body2: &RigidBodyQueryItem<'_>, collider_entity1: Entity, collider_entity2: Entity, contact: ContactData, manifold_index: usize ) -> Self
Creates a new PenetrationConstraint
with the given bodies and contact data.
The manifold_index
is the index of the contact in a ContactManifold
.
Trait Implementations§
source§impl Clone for PenetrationConstraint
impl Clone for PenetrationConstraint
source§fn clone(&self) -> PenetrationConstraint
fn clone(&self) -> PenetrationConstraint
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PenetrationConstraint
impl Debug for PenetrationConstraint
source§impl MapEntities for PenetrationConstraint
impl MapEntities for PenetrationConstraint
source§fn map_entities<M: EntityMapper>(&mut self, entity_mapper: &mut M)
fn map_entities<M: EntityMapper>(&mut self, entity_mapper: &mut M)
source§impl PartialEq for PenetrationConstraint
impl PartialEq for PenetrationConstraint
source§fn eq(&self, other: &PenetrationConstraint) -> bool
fn eq(&self, other: &PenetrationConstraint) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PositionConstraint for PenetrationConstraint
impl PositionConstraint for PenetrationConstraint
source§fn apply_positional_correction(
&self,
body1: &mut RigidBodyQueryItem<'_>,
body2: &mut RigidBodyQueryItem<'_>,
delta_lagrange: Scalar,
direction: Vector,
r1: Vector,
r2: Vector
) -> Vector
fn apply_positional_correction( &self, body1: &mut RigidBodyQueryItem<'_>, body2: &mut RigidBodyQueryItem<'_>, delta_lagrange: Scalar, direction: Vector, r1: Vector, r2: Vector ) -> Vector
source§fn compute_generalized_inverse_mass(
&self,
body: &RigidBodyQueryItem<'_>,
r: Vector,
n: Vector
) -> Scalar
fn compute_generalized_inverse_mass( &self, body: &RigidBodyQueryItem<'_>, r: Vector, n: Vector ) -> Scalar
r
along the vector n
.source§impl XpbdConstraint<2> for PenetrationConstraint
impl XpbdConstraint<2> for PenetrationConstraint
source§fn solve(&mut self, bodies: [&mut RigidBodyQueryItem<'_>; 2], dt: Scalar)
fn solve(&mut self, bodies: [&mut RigidBodyQueryItem<'_>; 2], dt: Scalar)
Solves overlap between two bodies.
source§fn clear_lagrange_multipliers(&mut self)
fn clear_lagrange_multipliers(&mut self)
impl Copy for PenetrationConstraint
impl StructuralPartialEq for PenetrationConstraint
Auto Trait Implementations§
impl RefUnwindSafe for PenetrationConstraint
impl Send for PenetrationConstraint
impl Sync for PenetrationConstraint
impl Unpin for PenetrationConstraint
impl UnwindSafe for PenetrationConstraint
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.