Struct ContactData.Contact
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
Bias
Velocity bias for restitution (bounce).
public float Bias
Field Value
BiasFactor
Fraction of penetration corrected per step (Baumgarte stabilization).
public const float BiasFactor = 0.2
Field Value
BreakThreshold
Separation distance beyond which a contact is considered broken.
public const float BreakThreshold = 0.02
Field Value
Flag
Current contact state flags.
public ContactData.Contact.Flags Flag
Field Value
MaximumBias
Maximum position-correction bias applied per iteration.
public const float MaximumBias = 100
Field Value
PenaltyBias
Position-correction bias computed from penetration depth.
public float PenaltyBias
Field Value
RelativePosition1
Position of the contact relative to the center of mass on the first body.
[ReferenceFrame(ReferenceFrame.World)]
public JVector RelativePosition1
Field Value
RelativePosition2
Position of the contact relative to the center of mass on the second body.
[ReferenceFrame(ReferenceFrame.World)]
public JVector RelativePosition2
Field Value
Properties
Impulse
The impulse applied in the normal direction which has been used to solve the contact.
public readonly float Impulse { get; }
Property Value
Normal
Normal direction (normalized) of the contact. Pointing from the collision point on the surface of Body2 to the collision point on the surface of Body1.
[ReferenceFrame(ReferenceFrame.World)]
public readonly JVector Normal { get; }
Property Value
Tangent1
Tangent (normalized) to the contact Normal in the direction of the relative movement of both bodies, at the time when the contact is created.
[ReferenceFrame(ReferenceFrame.World)]
public readonly JVector Tangent1 { get; }
Property Value
Tangent2
[ReferenceFrame(ReferenceFrame.World)]
public readonly JVector Tangent2 { get; }
Property Value
TangentImpulse1
The impulse applied in the first tangent direction which has been used to solve the contact.
public readonly float TangentImpulse1 { get; }
Property Value
TangentImpulse2
The impulse applied in the second tangent direction which has been used to solve the contact.
public readonly float TangentImpulse2 { get; }
Property Value
Methods
Initialize(ref RigidBodyData, ref RigidBodyData, in JVector, in JVector, in JVector, bool, float)
public void Initialize(ref RigidBodyData b1, ref RigidBodyData b2, in JVector point1, in JVector point2, in JVector n, bool newContact, float restitution)
Parameters
b1RigidBodyDatab2RigidBodyDatapoint1JVectorpoint2JVectornJVectornewContactboolrestitutionfloat
Iterate(ContactData*, bool)
public void Iterate(ContactData* cd, bool applyBias)
Parameters
cdContactData*applyBiasbool
IterateAccelerated(ContactData*, bool)
public void IterateAccelerated(ContactData* cd, bool applyBias)
Parameters
cdContactData*applyBiasbool
PrepareForIteration(ContactData*, float)
public void PrepareForIteration(ContactData* cd, float idt)
Parameters
cdContactData*idtfloat
PrepareForIterationAccelerated(ContactData*, float)
public void PrepareForIterationAccelerated(ContactData* cd, float idt)
Parameters
cdContactData*idtfloat
UpdatePosition(ContactData*)
public readonly bool UpdatePosition(ContactData* cd)
Parameters
cdContactData*