ReactPhysics3D  v0.10.2
C++ Physics engine library
Loading...
Searching...
No Matches
reactphysics3d::CollisionCallback::ContactPair Class Reference

This class represents the contact between two colliders of the physics world. More...

#include <include/reactphysics3d/collision/CollisionCallback.h>

Public Types

enum class  EventType { ContactStart , ContactStay , ContactExit }
 Enumeration EventType that describes the type of contact event. More...
 

Public Member Functions

 ContactPair (const ContactPair &contactPair)=default
 Copy constructor.
 
ContactPairoperator= (const ContactPair &contactPair)=delete
 Assignment operator.
 
 ~ContactPair ()=default
 Destructor.
 
uint32 getNbContactPoints () const
 Return the number of contact points in the contact pair.
 
ContactPoint getContactPoint (uint32 index) const
 Return a given contact point.
 
BodygetBody1 () const
 Return a pointer to the first body in contact.
 
BodygetBody2 () const
 Return a pointer to the second body in contact.
 
CollidergetCollider1 () const
 Return a pointer to the first collider in contact (in body 1)
 
CollidergetCollider2 () const
 Return a pointer to the second collider in contact (in body 2)
 
EventType getEventType () const
 Return the corresponding type of event for this contact pair.
 

Detailed Description

This class represents the contact between two colliders of the physics world.

A contact pair contains an array of contact points.

Member Enumeration Documentation

◆ EventType

Enumeration EventType that describes the type of contact event.

Enumerator
ContactStart 

This contact is a new contact between the two colliders (the colliders where not touching in the previous frame)

ContactStay 

The two colliders were already touching in the previous frame and this is a new or updated contact.

ContactExit 

The two colliders were in contact in the previous frame and are not in contact anymore.

Member Function Documentation

◆ getBody1()

Body * CollisionCallback::ContactPair::getBody1 ( ) const

Return a pointer to the first body in contact.

Returns
A pointer to the first colliding body of the pair

◆ getBody2()

Body * CollisionCallback::ContactPair::getBody2 ( ) const

Return a pointer to the second body in contact.

Returns
A pointer to the second colliding body of the pair

◆ getCollider1()

Collider * CollisionCallback::ContactPair::getCollider1 ( ) const

Return a pointer to the first collider in contact (in body 1)

Returns
A pointer to the first collider of the contact pair

◆ getCollider2()

Collider * CollisionCallback::ContactPair::getCollider2 ( ) const

Return a pointer to the second collider in contact (in body 2)

Returns
A pointer to the second collider of the contact pair

◆ getContactPoint()

CollisionCallback::ContactPoint CollisionCallback::ContactPair::getContactPoint ( uint32  index) const

Return a given contact point.

Note that the returned ContactPoint object is only valid during the call of the CollisionCallback::onContact() method.

Parameters
indexIndex of the contact point to retrieve
Returns
A contact point object

Therefore, you need to get contact data from it and make a copy. Do not make a copy of the ContactPoint object itself because it won't be valid after the CollisionCallback::onContact() call.

◆ getEventType()

CollisionCallback::ContactPair::EventType CollisionCallback::ContactPair::getEventType ( ) const

Return the corresponding type of event for this contact pair.

Returns
The type of contact event for this contact pair

◆ getNbContactPoints()

RP3D_FORCE_INLINE uint32 reactphysics3d::CollisionCallback::ContactPair::getNbContactPoints ( ) const

Return the number of contact points in the contact pair.

Returns
The number of contact points in the contact pair
The number of contact points

The documentation for this class was generated from the following files: