Table of Contents

Struct ContactData.Contact

Namespace
Jitter2.Dynamics
Assembly
Jitter2.dll

Represents a single contact point between two rigid bodies.

public struct ContactData.Contact
Inherited Members

Remarks

This structure is layout-sensitive and stored in unmanaged memory as part of a ContactData. It contains geometric information (normal, tangents, positions) and solver state (accumulated impulses, bias).

Do not cache or store references to this structure across simulation steps.

Fields

AllowedPenetration

Penetration depth below which no position correction is applied.

public const float AllowedPenetration = 0.01

Field Value

float

Bias

Velocity bias for restitution or speculative separation.

public float Bias

Field Value

float

BiasFactor

Fraction of penetration corrected per step (Baumgarte stabilization).

public const float BiasFactor = 0.2

Field Value

float

BreakThreshold

Maximum tangential drift before a contact breaks; normal separation is limited to one tenth of this value.

public const float BreakThreshold = 0.02

Field Value

float

Flag

Current contact state flags.

public ContactData.Contact.Flags Flag

Field Value

ContactData.Contact.Flags

MaximumBias

Maximum position-correction bias applied per iteration.

public const float MaximumBias = 100

Field Value

float

PenaltyBias

Position-correction bias computed from penetration depth.

public float PenaltyBias

Field Value

float

RelativePosition1

World-space contact offset from the first body's center of mass used to apply impulses. Held fixed during the substeps of a full simulation step.

[ReferenceFrame(ReferenceFrame.World)]
public JVector RelativePosition1

Field Value

JVector

RelativePosition2

World-space contact offset from the second body's center of mass used to apply impulses. Held fixed during the substeps of a full simulation step.

[ReferenceFrame(ReferenceFrame.World)]
public JVector RelativePosition2

Field Value

JVector

Properties

Impulse

Gets the accumulated normal solver impulse from the last solved substep.

public readonly float Impulse { get; }

Property Value

float

Normal

Normalized contact direction. A positive normal impulse pushes Body2 along this direction and Body1 against it. For overlapping contact points, the normal points from the point on body 2 toward the point on body 1. Updated when collision detection refreshes the contact.

[ReferenceFrame(ReferenceFrame.World)]
public readonly JVector Normal { get; }

Property Value

JVector

Tangent1

Tangent (normalized) to the contact Normal. At creation it follows tangential relative velocity when nonzero; otherwise it is an arbitrary tangent. Cached contacts adjust their tangent directions when the normal changes.

[ReferenceFrame(ReferenceFrame.World)]
public readonly JVector Tangent1 { get; }

Property Value

JVector

Tangent2

A second tangent forming an orthonormal basis with Normal and Tangent1.

[ReferenceFrame(ReferenceFrame.World)]
public readonly JVector Tangent2 { get; }

Property Value

JVector

TangentImpulse1

Gets the accumulated solver impulse in the first tangent direction from the last solved substep.

public readonly float TangentImpulse1 { get; }

Property Value

float

TangentImpulse2

Gets the accumulated solver impulse in the second tangent direction from the last solved substep.

public readonly float TangentImpulse2 { get; }

Property Value

float

Methods

Initialize(ContactData*, in JVector, in JVector, in JVector, bool)

public void Initialize(ContactData* cd, in JVector point1, in JVector point2, in JVector n, bool newContact)

Parameters

cd ContactData*
point1 JVector
point2 JVector
n JVector
newContact bool

Iterate(ContactData*, bool)

public void Iterate(ContactData* cd, bool applyBias)

Parameters

cd ContactData*
applyBias bool

IterateAccelerated(ContactData*, bool)

public void IterateAccelerated(ContactData* cd, bool applyBias)

Parameters

cd ContactData*
applyBias bool

PrepareForIteration(ContactData*, in TimeStep)

public void PrepareForIteration(ContactData* cd, in TimeStep timeStep)

Parameters

cd ContactData*
timeStep TimeStep

PrepareForIterationAccelerated(ContactData*, in TimeStep)

public void PrepareForIterationAccelerated(ContactData* cd, in TimeStep timeStep)

Parameters

cd ContactData*
timeStep TimeStep

UpdatePosition(ContactData*)

public bool UpdatePosition(ContactData* cd)

Parameters

cd ContactData*

Returns

bool