Quantum 3 3.1.0

Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
Quantum.Physics2D.CollisionResultInfo2D Struct Reference

A structure for containing all the result information from the collision between two shapes. More...

Public Member Functions

Span< FPVector2 > GetContactPoints ()
 Gets a span of the contact points in the collision. More...
 
ref FPVector2 GetPoint (Int32 contactPointIndex)
 Gets a reference to the contact point at the given index. More...
 

Static Public Member Functions

static void AddContactPoint (CollisionResultInfo2D *result, FPVector2 cp)
 Adds to the buffer of contact points a new contact point. For a 2D collision, the maximum number of contact point is CollisionManifold2D.MAX_CONTACT_POINTS. More...
 
static FPVector2 GetAveragePoint (CollisionResultInfo2D *result)
 Gets the average point between all the contact points computed. More...
 
static FPVector2 GetPoint (CollisionResultInfo2D *result)
 
static FPVector2 GetPoint (CollisionResultInfo2D *result, Int32 contactPointIndex)
 Get the contact point of the collision by some index. More...
 
static Hit UpdateHitWithResult (CollisionResultInfo2D *result, ref Hit hit)
 Updates all the hit fields with the equivalent results of the collision. More...
 

Public Attributes

FPVector2 Normal
 The contact normal. More...
 
FP Penetration
 The collision penetration in the Normal direction. More...
 

Properties

readonly int ContactPointsCount [get]
 The number of found contact points. More...
 

Detailed Description

A structure for containing all the result information from the collision between two shapes.

Member Function Documentation

◆ GetContactPoints()

Span<FPVector2> Quantum.Physics2D.CollisionResultInfo2D.GetContactPoints ( )
inline

Gets a span of the contact points in the collision.

Returns
A pointer to the beginning of the contact points vector buffer.

How to iterate over the contact points:

for (int i = 0; i < span.Length; i++) {
ref var cp = span[i];
}

◆ GetPoint() [1/2]

static FPVector2 Quantum.Physics2D.CollisionResultInfo2D.GetPoint ( CollisionResultInfo2D *  result,
Int32  contactPointIndex 
)
inlinestatic

Get the contact point of the collision by some index.

Parameters
resultThe CollisionResultInfo2D reference.
contactPointIndexIndex of the contact point.
Returns
Returns a specified contact point as FPVector2.

◆ GetPoint() [2/2]

ref FPVector2 Quantum.Physics2D.CollisionResultInfo2D.GetPoint ( Int32  contactPointIndex)
inline

Gets a reference to the contact point at the given index.

Parameters
contactPointIndexIndex of the contact point.
Returns
Exceptions
IndexOutOfRangeExceptionIn case the contactPointIndex is out of the [0, ContactPointsCount) range.

◆ AddContactPoint()

static void Quantum.Physics2D.CollisionResultInfo2D.AddContactPoint ( CollisionResultInfo2D *  result,
FPVector2  cp 
)
inlinestatic

Adds to the buffer of contact points a new contact point. For a 2D collision, the maximum number of contact point is CollisionManifold2D.MAX_CONTACT_POINTS.

Parameters
resultThe CollisionResultInfo2D reference.
cpThe contact point value.

◆ GetAveragePoint()

static FPVector2 Quantum.Physics2D.CollisionResultInfo2D.GetAveragePoint ( CollisionResultInfo2D *  result)
inlinestatic

Gets the average point between all the contact points computed.

Parameters
resultThe CollisionResultInfo2D reference.
Returns
The average point of all contact points.

◆ UpdateHitWithResult()

static Hit Quantum.Physics2D.CollisionResultInfo2D.UpdateHitWithResult ( CollisionResultInfo2D *  result,
ref Hit  hit 
)
inlinestatic

Updates all the hit fields with the equivalent results of the collision.

Parameters
resultThe CollisionResultInfo2D reference.
hitThe Hit reference.
Returns
A copy of the hit with the values updated.

Member Data Documentation

◆ Penetration

FP Quantum.Physics2D.CollisionResultInfo2D.Penetration

The collision penetration in the Normal direction.

◆ Normal

FPVector2 Quantum.Physics2D.CollisionResultInfo2D.Normal

The contact normal.

Property Documentation

◆ ContactPointsCount

readonly int Quantum.Physics2D.CollisionResultInfo2D.ContactPointsCount
get

The number of found contact points.