Colliding Shapes
Ian Parberry's "Introduction to Game Physics"
Public Member Functions | Public Attributes | List of all members
CContactDesc Class Reference

Contact descriptor. More...

#include <Contact.h>

Public Member Functions

 CContactDesc (CShape *, CDynamicCircle *)
 Constructor. More...
 
 CContactDesc ()
 Default constructor. More...
 

Public Attributes

CShapem_pShape = nullptr
 Pointer to static or kinematic shape.
 
CDynamicCirclem_pCircle = nullptr
 Pointer to dynamic circle.
 
Vector2 m_vPOI
 POI.
 
Vector2 m_vNorm
 Normal to collision.
 
float m_fSetback = 0.0f
 Setback distance.
 
float m_fSpeed = 0.0f
 Collision speed.
 

Detailed Description

A record of contact between a shape (which may be static, kinematic, or dynamic) and a dynamic circle. Collision detection functions take as input a contact descriptor with the pointers to the shapes, and it fills in the details of the contact if there is one. This filled-out contact descriptor is then passed to the collision response function.

Constructor & Destructor Documentation

◆ CContactDesc() [1/2]

CContactDesc::CContactDesc ( CShape p0,
CDynamicCircle p1 
)

This constructor constructs a contact descriptor given a pointer to a shape and a pointer to a dynamic circle. No attempt is made to determine whether these shapes are indeed in contact, and the pointers may be null.

◆ CContactDesc() [2/2]

CContactDesc::CContactDesc ( )

The default constructor constructs a contact descriptor whose pointers are null. What could possibly go wrong?