Struct ContactData
Holds up to four ContactData.Contact structs for a single shape-to-shape collision.
public struct ContactData
- Inherited Members
Remarks
This structure is stored in unmanaged memory and accessed via Handle. The UsageMask bitfield indicates which of the four contact slots are active.
The returned data is valid only while the associated arbiter exists and must not be accessed concurrently with Step(float, bool). Do not cache references to this structure.
Fields
Body1
Handle to the first body's simulation data.
public JHandle<RigidBodyData> Body1
Field Value
Body2
Handle to the second body's simulation data.
public JHandle<RigidBodyData> Body2
Field Value
Contact0
First contact point.
public ContactData.Contact Contact0
Field Value
Contact1
Second contact point.
public ContactData.Contact Contact1
Field Value
Contact2
Third contact point.
public ContactData.Contact Contact2
Field Value
Contact3
Fourth contact point.
public ContactData.Contact Contact3
Field Value
Friction
Combined friction coefficient for this contact pair.
public float Friction
Field Value
Key
Unique key identifying this arbiter's shape pair.
public ArbiterKey Key
Field Value
MaskContact0
Bit mask for contact slot 0.
public const uint MaskContact0 = 1
Field Value
MaskContact1
Bit mask for contact slot 1.
public const uint MaskContact1 = 2
Field Value
MaskContact2
Bit mask for contact slot 2.
public const uint MaskContact2 = 4
Field Value
MaskContact3
Bit mask for contact slot 3.
public const uint MaskContact3 = 8
Field Value
MaskContactAll
Bit mask indicating all four contact slots are in use.
public const uint MaskContactAll = 15
Field Value
Mode
Determines which velocity components are updated by the solver.
public ContactData.SolveMode Mode
Field Value
Restitution
Combined restitution coefficient for this contact pair.
public float Restitution
Field Value
UsageMask
Bits 0–3 mark contacts that are currently valid; bits 4–7 mark contacts used in the last solve.
public uint UsageMask
Field Value
Remarks
A contact can be used by the solver and then break as the bodies move during the same step. Its solver bit remains set even though its current-validity bit has been cleared.
Properties
IsHardwareAccelerated
Gets whether the contact solver can use hardware-accelerated vector operations.
public static bool IsHardwareAccelerated { get; }
Property Value
Settings
The settings of the world this contact belongs to.
public ref ContactSettings Settings { get; }
Property Value
Methods
AddContact(in JVector, in JVector, in JVector)
Adds a new collision result to the contact manifold. Keeps at most four points.
public void AddContact(in JVector point1, in JVector point2, in JVector normal)
Parameters
point1JVectorContact point on the first body in world space.
point2JVectorContact point on the second body in world space.
normalJVectorUnit contact normal pointing from the first body toward the second.
Init(RigidBody, RigidBody)
Initializes this contact data for a pair of rigid bodies.
public void Init(RigidBody body1, RigidBody body2)
Parameters
Iterate(bool)
Performs one solver iteration over all active contacts, applying corrective impulses.
public void Iterate(bool applyBias)
Parameters
PrepareForIteration(in TimeStep)
Prepares all active contacts for solver iterations by computing effective masses and warm-starting impulses.
public void PrepareForIteration(in TimeStep timeStep)
Parameters
timeStepTimeStepThe full step and substep timing information.
ResetImpulses()
Clears the accumulated normal and friction impulses of all active contacts.
public void ResetImpulses()
ResetMode(SolveMode)
Resets the solve mode based on the current motion types of the bodies, then removes the specified flags.
public void ResetMode(ContactData.SolveMode removeFlags = SolveMode.None)
Parameters
removeFlagsContactData.SolveModeFlags to remove from the full solve mode.
SkipWarmStart()
Skips replaying accumulated impulses on the next preparation of each active contact.
public void SkipWarmStart()
UpdatePosition()
Updates contact positions after integration and removes contacts whose normal separation exceeds one tenth of the break threshold or whose tangential drift exceeds the full threshold.
public void UpdatePosition()