Skip to main content

SolverContact

Type Alias SolverContact 

Source
pub type SolverContact = SolverContactGeneric<f32, 1>;
Expand description

A single solver contact.

Aliased Type§

#[repr(C, align(16))]
pub struct SolverContact { pub anchor1: Vec2, pub anchor2: Vec2, pub dist: f32, pub tangent_velocity: Vec2, pub contact_id: [u32; 1], }

Fields§

§anchor1: Vec2

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: Vec2

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: f32

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: Vec2

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; 1]

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