Struct ConvexContactManifold
- Namespace
- BepuPhysics.CollisionDetection
- Assembly
- BepuPhysics.dll
Contains the data associated with a convex contact manifold.
public struct ConvexContactManifold : IContactManifold<ConvexContactManifold>
- Implements
- Inherited Members
Fields
Contact0
public ConvexContact Contact0
Field Value
Contact1
public ConvexContact Contact1
Field Value
Contact2
public ConvexContact Contact2
Field Value
Contact3
public ConvexContact Contact3
Field Value
Count
public int Count
Field Value
Normal
Surface normal shared by all contacts. Points from collidable B to collidable A.
public Vector3 Normal
Field Value
OffsetB
Offset from collidable A to collidable B.
public Vector3 OffsetB
Field Value
Properties
this[int]
Gets or sets the contact at the given index in the manifold.
public Contact this[int contactIndex] { get; set; }
Parameters
contactIndex
intIndex 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
FastRemoveAt(ref ConvexContactManifold, int)
public static void FastRemoveAt(ref ConvexContactManifold manifold, int index)
Parameters
manifold
ConvexContactManifoldindex
int
GetContact(int, out Contact)
Gets a copy of a contact's data.
public void GetContact(int contactIndex, out Contact contactData)
Parameters
contactIndex
intIndex of the contact to copy data from.
contactData
ContactData associated with the contact.
GetContact(int, out Vector3, out Vector3, out float, out int)
Retrieves 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
intIndex of the contact to copy data from.
offset
Vector3Offset from the first collidable's position to the contact position.
normal
Vector3Normal of the contact surface at the requested contact. Points from collidable B to collidable A.
depth
floatPenetration depth at the requested contact.
featureId
intFeature 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 ConvexContactManifold, int)
Gets a reference to a convex manifold's contact.
public static ref ConvexContact GetConvexContactReference(ref ConvexContactManifold manifold, int contactIndex)
Parameters
manifold
ConvexContactManifoldManifold to pull a reference from.
contactIndex
intContact 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
intIndex of the contact to grab the depth of.
Returns
- float
Depth of the requested contact.
GetDepthReference(ref ConvexContactManifold, int)
Gets a reference to a contact's depth.
public static ref float GetDepthReference(ref ConvexContactManifold manifold, int contactIndex)
Parameters
manifold
ConvexContactManifoldManifold to pull a reference from.
contactIndex
intContact 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
intIndex of the contact to grab the feature id of.
Returns
- int
Feature id of the requested contact.
GetFeatureIdReference(ref ConvexContactManifold, int)
Gets a reference to a contact's feature id.
public static ref int GetFeatureIdReference(ref ConvexContactManifold manifold, int contactIndex)
Parameters
manifold
ConvexContactManifoldManifold to pull a reference from.
contactIndex
intContact to pull data from.
Returns
- int
Reference to a contact's feature id.
GetNonconvexContactReference(ref ConvexContactManifold, int)
Gets a reference to a nonconvex manifold's contact.
public static ref Contact GetNonconvexContactReference(ref ConvexContactManifold manifold, int contactIndex)
Parameters
manifold
ConvexContactManifoldManifold to pull a reference from.
contactIndex
intContact 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
intIndex 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 ConvexContactManifold, 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 ConvexContactManifold manifold, int contactIndex)
Parameters
manifold
ConvexContactManifoldManifold to pull a reference from.
contactIndex
intContact 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
intIndex of the contact to grab the offset of.
Returns
- Vector3
Offset to a contact's offset.
GetOffsetReference(ref ConvexContactManifold, int)
Gets a reference to the offset from collidable A to the requested contact.
public static ref Vector3 GetOffsetReference(ref ConvexContactManifold manifold, int contactIndex)
Parameters
manifold
ConvexContactManifoldManifold to pull a reference from.
contactIndex
intContact to pull data from.
Returns
- Vector3
Reference to a contact's offset.