Skip to main content

SimdSolverContact

Type Alias SimdSolverContact 

Source
pub type SimdSolverContact = SolverContactGeneric<SimdReal, SIMD_WIDTH>;
Expand description

A group of SIMD_WIDTH solver contacts stored in SoA fashion for SIMD optimizations.

Aliased Type§

#[repr(C, align(16))]
pub struct SimdSolverContact { pub anchor1: Matrix<WideF32x4, Const<2>, Const<1>, ArrayStorage<WideF32x4, 2, 1>>, pub anchor2: Matrix<WideF32x4, Const<2>, Const<1>, ArrayStorage<WideF32x4, 2, 1>>, pub dist: WideF32x4, pub tangent_velocity: Matrix<WideF32x4, Const<2>, Const<1>, ArrayStorage<WideF32x4, 2, 1>>, pub contact_id: [u32; 4], }

Fields§

§anchor1: Matrix<WideF32x4, Const<2>, Const<1>, ArrayStorage<WideF32x4, 2, 1>>

The 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: Matrix<WideF32x4, Const<2>, Const<1>, ArrayStorage<WideF32x4, 2, 1>>

The 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: WideF32x4

Distance 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: Matrix<WideF32x4, Const<2>, Const<1>, ArrayStorage<WideF32x4, 2, 1>>

The 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: [u32; 4]

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 SimdSolverContact

Source

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.