Table of Contents

Class ContactManifold2D

Namespace
Gravitas.CollisionHandling
Assembly
Gravitas.dll

Fixed-capacity deterministic pure 2D contact manifold owned by one collision pair.

public sealed class ContactManifold2D : IEnumerable<ManifoldContact2D>, IEnumerable
Inheritance
ContactManifold2D
Implements
Inherited Members

Constructors

ContactManifold2D()

public ContactManifold2D()

Fields

MaxContactCount

Maximum number of contacts retained by a pure 2D manifold.

public const int MaxContactCount = 2

Field Value

int

Properties

Count

Number of active contacts in this manifold.

public int Count { 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 the contact at the specified deterministic order index.

public ManifoldContact2D this[int index] { get; }

Parameters

index int

Property Value

ManifoldContact2D

LastUpdatedFrame

Simulation frame in which the active contacts were last rebuilt.

public int LastUpdatedFrame { get; }

Property Value

int

PrimaryContact

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

public ManifoldContact2D PrimaryContact { get; }

Property Value

ManifoldContact2D

Methods

AddContact(Vector2d, Vector2d, Fixed64, Vector2d)

Adds a contact, keeping the deepest two contacts and exposing them by stable contact identity.

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

Parameters

pointA Vector2d
pointB Vector2d
depth Fixed64
normal Vector2d

AddContact(ContactAnchor2D, ContactAnchor2D, Fixed64, Vector2d, bool)

Adds a canonical rigid-frame contact, keeping the deepest two contacts and exposing them by stable anchor identity.

public void AddContact(ContactAnchor2D anchorA, ContactAnchor2D anchorB, Fixed64 depth, Vector2d normal, bool depthIsClamped = false)

Parameters

anchorA ContactAnchor2D
anchorB ContactAnchor2D
depth Fixed64
normal Vector2d
depthIsClamped bool

BeginUpdate(int)

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

public void BeginUpdate(int frame)

Parameters

frame int

GetEnumerator()

Returns an allocation-free enumerator over the active contacts.

public ContactManifold2D.Enumerator GetEnumerator()

Returns

ContactManifold2D.Enumerator

Reset()

Clears all contact data.

public void Reset()

SetContact(Vector2d, Vector2d, Fixed64, Vector2d)

Replaces the manifold with one contact.

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

Parameters

pointA Vector2d
pointB Vector2d
depth Fixed64
normal Vector2d

SetContact(ContactAnchor2D, ContactAnchor2D, Fixed64, Vector2d, bool)

Replaces the manifold with one canonical rigid-frame planar contact.

public void SetContact(ContactAnchor2D anchorA, ContactAnchor2D anchorB, Fixed64 depth, Vector2d normal, bool depthIsClamped = false)

Parameters

anchorA ContactAnchor2D
anchorB ContactAnchor2D
depth Fixed64
normal Vector2d
depthIsClamped bool