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

source

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

source§

fn clone(&self) -> PenetrationConstraint

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PenetrationConstraint

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl MapEntities for PenetrationConstraint

source§

fn map_entities<M: EntityMapper>(&mut self, entity_mapper: &mut M)

Updates all [Entity] references stored inside using entity_mapper. Read more
source§

impl PartialEq for PenetrationConstraint

source§

fn eq(&self, other: &PenetrationConstraint) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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

Applies a positional correction to two bodies. Read more
source§

fn compute_generalized_inverse_mass( &self, body: &RigidBodyQueryItem<'_>, r: Vector, n: Vector ) -> Scalar

Computes the generalized inverse mass of a body when applying a positional correction at point r along the vector n.
source§

fn get_delta_rot( _rot: Rotation, inverse_inertia: Scalar, r: Vector, p: Vector ) -> Rotation

Computes the update in rotation when applying a positional correction p at point r.
source§

fn compute_force( &self, lagrange: Scalar, direction: Vector, dt: Scalar ) -> Vector

Computes the force acting along the constraint using the equation f = lambda * n / h^2
source§

impl XpbdConstraint<2> for PenetrationConstraint

source§

fn solve(&mut self, bodies: [&mut RigidBodyQueryItem<'_>; 2], dt: Scalar)

Solves overlap between two bodies.

source§

fn entities(&self) -> [Entity; 2]

The entities participating in the constraint.
source§

fn clear_lagrange_multipliers(&mut self)

Sets the constraint’s Lagrange multipliers to 0.
source§

fn compute_lagrange_update( &self, lagrange: Scalar, c: Scalar, gradients: &[Vector], inverse_masses: &[Scalar], compliance: Scalar, dt: Scalar ) -> Scalar

Computes how much a constraint’s Lagrange multiplier changes when projecting the constraint for all participating particles. Read more
source§

impl Copy for PenetrationConstraint

source§

impl StructuralPartialEq for PenetrationConstraint

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U

Return the T [ShaderType] for self. When used in [AsBindGroup] derives, it is safe to assume that all images in self exist.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> TypeData for T
where T: 'static + Send + Sync + Clone,

§

fn clone_type_data(&self) -> Box<dyn TypeData>

§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

§

impl<T> Settings for T
where T: 'static + Send + Sync,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,