ReactPhysics3D: reactphysics3d::CollisionCallback::ContactPair Class Reference

| ReactPhysics3D v0.10.2 C++ Physics engine library

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
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.
ContactPair & | operator= (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.
Body * | getBody1 () const
| Return a pointer to the first body in contact.
Body * | getBody2 () const
| Return a pointer to the second body in contact.
Collider * | getCollider1 () const
| Return a pointer to the first collider in contact (in body 1)
Collider * | getCollider2 () 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

enum class reactphysics3d::CollisionCallback::ContactPair::EventType
| strong

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

  index | Index 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:

- include/reactphysics3d/collision/CollisionCallback.h
- src/collision/CollisionCallback.cpp