Table of Contents

Interface IContactManifold<TManifold>

Namespace
BepuPhysics.CollisionDetection
Assembly
BepuPhysics.dll
public interface IContactManifold<TManifold> where TManifold : struct, IContactManifold<TManifold>

Type Parameters

TManifold

Properties

Convex

Gets whether the contact manifold was created by a pair of convex objects or not. True if convex, false if nonconvex.

bool Convex { get; }

Property Value

bool

Count

Gets the number of contacts in the manifold.

int Count { get; }

Property Value

int

this[int]

Gets or sets the contact at the given index in the manifold.

Contact this[int contactIndex] { get; set; }

Parameters

contactIndex int

Index of the contact to get or set.

Property Value

Contact

Contact at the specified index.

Remarks

Note that contact normals are shared across a ConvexContactManifold. Setting one contact in a convex manifold will change the entire convex manifold's normal.

Methods

GetContact(int, out Contact)

Gets a copy of a contact's data.

void GetContact(int contactIndex, out Contact contactData)

Parameters

contactIndex int

Index of the contact to copy data from.

contactData Contact

Data associated with the contact.

GetContact(int, out Vector3, out Vector3, out float, out int)

Gets a copy of a contact's data.

void GetContact(int contactIndex, out Vector3 offset, out Vector3 normal, out float depth, out int featureId)

Parameters

contactIndex int

Index of the contact to copy data from.

offset Vector3

Offset from the first collidable's position to the contact position.

normal Vector3

Normal of the contact surface at the requested contact. Points from collidable B to collidable A.

depth float

Penetration depth at the requested contact.

featureId int

Feature id of the requested contact. Feature ids represent which parts of the collidables formed the contact and can be used to track unique contacts across frames.

GetConvexContactReference(ref TManifold, int)

Gets a reference to a convex manifold's contact.

public static abstract ref ConvexContact GetConvexContactReference(ref TManifold manifold, int contactIndex)

Parameters

manifold TManifold

Manifold to pull a reference from.

contactIndex int

Contact to pull data from.

Returns

ConvexContact

Reference to the requested contact.

Remarks

This is a helper that avoids manual casting. If the manifold is not a ConvexContactManifold, the function will throw an NotSupportedException.

GetDepth(int)

Gets the depth associated with a requested contact.

float GetDepth(int contactIndex)

Parameters

contactIndex int

Index of the contact to grab the depth of.

Returns

float

Depth of the requested contact.

GetDepthReference(ref TManifold, int)

Gets a reference to a contact's depth.

public static abstract ref float GetDepthReference(ref TManifold manifold, int contactIndex)

Parameters

manifold TManifold

Manifold to pull a reference from.

contactIndex int

Contact to pull data from.

Returns

float

Reference to a contact's depth.

GetFeatureId(int)

Gets the feature id associated with a requested contact.

int GetFeatureId(int contactIndex)

Parameters

contactIndex int

Index of the contact to grab the feature id of.

Returns

int

Feature id of the requested contact.

GetFeatureIdReference(ref TManifold, int)

Gets a reference to a contact's feature id.

public static abstract ref int GetFeatureIdReference(ref TManifold manifold, int contactIndex)

Parameters

manifold TManifold

Manifold to pull a reference from.

contactIndex int

Contact to pull data from.

Returns

int

Reference to a contact's feature id.

GetNonconvexContactReference(ref TManifold, int)

Gets a reference to a nonconvex manifold's contact.

public static abstract ref Contact GetNonconvexContactReference(ref TManifold manifold, int contactIndex)

Parameters

manifold TManifold

Manifold to pull a reference from.

contactIndex int

Contact to pull data from.

Returns

Contact

Reference to the requested contact.

Remarks

This is a helper that avoids manual casting. If the manifold is not a NonconvexContactManifold, the function will throw an NotSupportedException.

GetNormal(int)

Gets a contact's normal.

Vector3 GetNormal(int contactIndex)

Parameters

contactIndex int

Index of the contact to grab the normal of.

Returns

Vector3

Normal of the requested contact.

Remarks

Points from collidable B to collidable A. In convex manifolds, all contacts share a normal and will return the same value.

GetNormalReference(ref TManifold, int)

Gets a reference to a contact's normal. Points from collidable B to collidable A. For convex manifolds that share a normal, all contact indices will simply return a reference to the manifold-wide normal.

public static abstract ref Vector3 GetNormalReference(ref TManifold manifold, int contactIndex)

Parameters

manifold TManifold

Manifold to pull a reference from.

contactIndex int

Contact to pull data from.

Returns

Vector3

Reference to a contact's normal (or the manifold-wide normal in a convex manifold).

GetOffset(int)

Gets the offset from collidable A to the requested contact.

Vector3 GetOffset(int contactIndex)

Parameters

contactIndex int

Index of the contact to grab the offset of.

Returns

Vector3

Offset to a contact's offset.

GetOffsetReference(ref TManifold, int)

Gets a reference to the offset from collidable A to the requested contact.

public static abstract ref Vector3 GetOffsetReference(ref TManifold manifold, int contactIndex)

Parameters

manifold TManifold

Manifold to pull a reference from.

contactIndex int

Contact to pull data from.

Returns

Vector3

Reference to a contact's offset.