Table of Contents

Class ContactManifold

Namespace
Gravitas.CollisionHandling
Assembly
Gravitas.dll

Pair-owned deterministic contact manifold with up to four samples per geometric surface group and no fixed pair-wide group or contact limit.

public sealed class ContactManifold : IEnumerable<ManifoldContact>, IEnumerable
Inheritance
ContactManifold
Implements
Inherited Members

Remarks

Inspection flattens canonical structural group order, then ascending contact identity within each group. Index zero is not necessarily the deepest contact; use PrimaryContact for that purpose. Overflow capacity is retained across updates and resets; reaching a new high-water mark can allocate.

Constructors

ContactManifold()

public ContactManifold()

Fields

MaxContactsPerGroup

Maximum number of point samples retained per geometric surface group.

public const int MaxContactsPerGroup = 4

Field Value

int

Properties

Count

Total number of active samples across all groups, without a fixed pair-wide cap.

public int Count { get; }

Property Value

int

GroupCount

Number of independent surface regions currently retained; this has no fixed pair-wide cap.

public int GroupCount { get; }

Property Value

int

HasContact

Gets whether this manifold currently contains narrow-phase contact data.

public bool HasContact { get; }

Property Value

bool

this[int]

Gets a contact in flattened structural-group/ascending-contact-identity order.

public ManifoldContact this[int index] { get; }

Parameters

index int

Property Value

ManifoldContact

LastUpdatedFrame

Simulation frame in which the active contacts were last rebuilt.

public long LastUpdatedFrame { get; }

Property Value

long

PrimaryContact

Deepest contact in the manifold. Ties use the lowest contact identity.

public ManifoldContact PrimaryContact { get; }

Property Value

ManifoldContact

Methods

AddContact(Vector3d, Vector3d, Fixed64, Vector3d)

Adds a contact, keeping up to four samples in the default surface group and exposing them by stable contact identity.

public void AddContact(Vector3d pointA, Vector3d pointB, Fixed64 depth, Vector3d normal)

Parameters

pointA Vector3d
pointB Vector3d
depth Fixed64
normal Vector3d

AddContact(ContactAnchor, ContactAnchor, Fixed64, Vector3d, bool)

Adds a rigid-frame contact, keeping up to four samples in the default surface group and exposing them by stable anchor identity.

public void AddContact(ContactAnchor anchorA, ContactAnchor anchorB, Fixed64 depth, Vector3d normal, bool depthIsClamped = false)

Parameters

anchorA ContactAnchor
anchorB ContactAnchor
depth Fixed64
normal Vector3d
depthIsClamped bool

BeginUpdate(long)

Clears contacts and records the frame for a new narrow-phase pass.

public void BeginUpdate(long frame)

Parameters

frame long

GetEnumerator()

Returns an allocation-free enumerator over the active contacts.

public ContactManifold.Enumerator GetEnumerator()

Returns

ContactManifold.Enumerator

GetGroupContactCount(int)

Gets the number of retained samples in a group, from one through MaxContactsPerGroup.

public int GetGroupContactCount(int groupIndex)

Parameters

groupIndex int

Returns

int

GetGroupStartIndex(int)

Gets the first flattened point index of a group in canonical structural order.

public int GetGroupStartIndex(int groupIndex)

Parameters

groupIndex int

Returns

int

Reset()

Clears all contact data.

public void Reset()

SetContact(Vector3d, Vector3d, Fixed64, Vector3d)

Replaces the manifold with one contact.

public void SetContact(Vector3d pointA, Vector3d pointB, Fixed64 depth, Vector3d normal)

Parameters

pointA Vector3d
pointB Vector3d
depth Fixed64
normal Vector3d

SetContact(ContactAnchor, ContactAnchor, Fixed64, Vector3d, bool)

Replaces the manifold with one rigid-frame contact.

public void SetContact(ContactAnchor anchorA, ContactAnchor anchorB, Fixed64 depth, Vector3d normal, bool depthIsClamped = false)

Parameters

anchorA ContactAnchor
anchorB ContactAnchor
depth Fixed64
normal Vector3d
depthIsClamped bool