#[repr(C, align(16))]pub struct SolverContactGeneric<N: ScalarType, const LANES: usize> {
pub anchor1: N::Vector,
pub anchor2: N::Vector,
pub dist: N,
pub tangent_velocity: N::Vector,
pub contact_id: [ContactId; LANES],
}Expand description
A contact seen by the constraints solver for computing forces.
Fields§
§anchor1: N::VectorThe contact point on the first body’s surface (contact skin baked in), in that
body’s CoM-centered local frame so it rides rigidly with the body — what lets
contact recycling skip the per-frame world refresh. World-space instead for a side
without a solver body (none, or world-attached by dominance — fixed bodies included).
Inside PhysicsHooks::modify_solver_contacts this always holds the fresh
world-space point (hooks run before localization).
anchor2: N::VectorThe contact point on the second body’s surface, expressed like
Self::anchor1 (world-space when the second side is world-attached, i.e.
relative_dominance < 0, or inside the contact-modification hook).
dist: NDistance between the contact points along the normal at the last full contact
update (negative = penetration), minus the contact skins. Writable from
PhysicsHooks::modify_solver_contacts (the delta is baked into the anchors after
the hook); afterwards the solver re-derives the live separation and never reads this.
tangent_velocity: N::VectorThe desired tangent relative velocity at the contact point.
This is set to zero by default. Set to a non-zero value to simulate, e.g., conveyor belts.
contact_id: [ContactId; LANES]The index of the manifold contact used to generate this solver contact, in the
low 31 bits; bit 31 (NEW_CONTACT_BIT) is set if this contact did not exist
during the last full contact update (recycled steps leave it untouched; the
solver derives contact newness from the warm-start state instead).
Implementations§
Source§impl SolverContactGeneric<WideF32x4, SIMD_WIDTH>
impl SolverContactGeneric<WideF32x4, SIMD_WIDTH>
Sourcepub unsafe fn gather_unchecked(
contacts: &[&[SolverContact]; 4],
ks: [usize; 4],
) -> Self
pub unsafe fn gather_unchecked( contacts: &[&[SolverContact]; 4], ks: [usize; 4], ) -> Self
Gathers one solver contact per lane, at a per-lane index (the lanes of a constraint chunk may have different active-contact counts, so callers clamp each lane’s index to its own count).
§Safety
Every ks[k] must be a valid index into contacts[k] — the gather reads each
lane’s slice unchecked.
Source§impl<N: ScalarType, const LANES: usize> SolverContactGeneric<N, LANES>
impl<N: ScalarType, const LANES: usize> SolverContactGeneric<N, LANES>
Sourcepub fn contact_indices(&self) -> [ContactId; LANES]
pub fn contact_indices(&self) -> [ContactId; LANES]
The manifold contact indices, with the is-new bit masked off.
These indices are only valid within the timestep that produced this solver contact: manifold points may be reordered or replaced by the next narrow-phase update.
Trait Implementations§
Source§impl<N: Clone + ScalarType, const LANES: usize> Clone for SolverContactGeneric<N, LANES>
impl<N: Clone + ScalarType, const LANES: usize> Clone for SolverContactGeneric<N, LANES>
Source§fn clone(&self) -> SolverContactGeneric<N, LANES>
fn clone(&self) -> SolverContactGeneric<N, LANES>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<N: Copy + ScalarType, const LANES: usize> Copy for SolverContactGeneric<N, LANES>
Auto Trait Implementations§
impl<N, const LANES: usize> Freeze for SolverContactGeneric<N, LANES>
impl<N, const LANES: usize> RefUnwindSafe for SolverContactGeneric<N, LANES>
impl<N, const LANES: usize> Send for SolverContactGeneric<N, LANES>
impl<N, const LANES: usize> Sync for SolverContactGeneric<N, LANES>
impl<N, const LANES: usize> Unpin for SolverContactGeneric<N, LANES>
impl<N, const LANES: usize> UnsafeUnpin for SolverContactGeneric<N, LANES>
impl<N, const LANES: usize> UnwindSafe for SolverContactGeneric<N, LANES>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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 moreimpl<T> MaybeSync 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.