Table of Contents

Struct NonconvexContactManifold

Namespace
BepuPhysics.CollisionDetection
Assembly
BepuPhysics.dll

Contains the data associated with a nonconvex contact manifold.

public struct NonconvexContactManifold : IContactManifold<NonconvexContactManifold>
Implements
Inherited Members

Fields

Contact0

public Contact Contact0

Field Value

Contact

Contact1

public Contact Contact1

Field Value

Contact

Contact2

public Contact Contact2

Field Value

Contact

Contact3

public Contact Contact3

Field Value

Contact

Count

public int Count

Field Value

int

MaximumContactCount

The maximum number of contacts that can exist within a nonconvex manifold.

public const int MaximumContactCount = 4

Field Value

int

OffsetB

Offset from collidable A to collidable B.

public Vector3 OffsetB

Field Value

Vector3

Properties

this[int]

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

public 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

Add(NonconvexContactManifold*, ref Vector3, ref ConvexContact)

public static void Add(NonconvexContactManifold* manifold, ref Vector3 normal, ref ConvexContact convexContact)

Parameters

manifold NonconvexContactManifold*
normal Vector3
convexContact ConvexContact

Allocate(NonconvexContactManifold*)

public static ref Contact Allocate(NonconvexContactManifold* manifold)

Parameters

manifold NonconvexContactManifold*

Returns

Contact

FastRemoveAt(NonconvexContactManifold*, int)

public static void FastRemoveAt(NonconvexContactManifold* manifold, int index)

Parameters

manifold NonconvexContactManifold*
index int

GetContact(int, out Contact)

Gets a copy of a contact's data.

public 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.

public 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 NonconvexContactManifold, int)

Gets a reference to a convex manifold's contact.

public static ref ConvexContact GetConvexContactReference(ref NonconvexContactManifold manifold, int contactIndex)

Parameters

manifold NonconvexContactManifold

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.

public 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 NonconvexContactManifold, int)

Gets a reference to a contact's depth.

public static ref float GetDepthReference(ref NonconvexContactManifold manifold, int contactIndex)

Parameters

manifold NonconvexContactManifold

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.

public 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 NonconvexContactManifold, int)

Gets a reference to a contact's feature id.

public static ref int GetFeatureIdReference(ref NonconvexContactManifold manifold, int contactIndex)

Parameters

manifold NonconvexContactManifold

Manifold to pull a reference from.

contactIndex int

Contact to pull data from.

Returns

int

Reference to a contact's feature id.

GetNonconvexContactReference(ref NonconvexContactManifold, int)

Gets a reference to a nonconvex manifold's contact.

public static ref Contact GetNonconvexContactReference(ref NonconvexContactManifold manifold, int contactIndex)

Parameters

manifold NonconvexContactManifold

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.

public 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 NonconvexContactManifold, 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 ref Vector3 GetNormalReference(ref NonconvexContactManifold manifold, int contactIndex)

Parameters

manifold NonconvexContactManifold

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.

public 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 NonconvexContactManifold, int)

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

public static ref Vector3 GetOffsetReference(ref NonconvexContactManifold manifold, int contactIndex)

Parameters

manifold NonconvexContactManifold

Manifold to pull a reference from.

contactIndex int

Contact to pull data from.

Returns

Vector3

Reference to a contact's offset.