The Shapes Library
Game Physics with Bespoke Code
Loading...
Searching...
No Matches
Shapes::CContactDesc Class Reference

Contact descriptor. More...

#include <Contact.h>

Collaboration diagram for Shapes::CContactDesc:

Public Member Functions

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

Public Attributes

CShapem_pShape = nullptr
 Pointer to static or kinematic shape.
 
CDynamicCirclem_pCircle = nullptr
 Pointer to dynamic circle.
 
Vector2 m_vPOI
 Point of intersection.
 
Vector2 m_vNorm
 Normal to the 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]

Shapes::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.

Parameters
p0Pointer to a shape.
p1Pointer to a dynamic circle.

◆ CContactDesc() [2/2]

Shapes::CContactDesc::CContactDesc ( )

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