SuperTuxKart

Bullet can report the same collision more than once (up to 4 contact points per collision. More...
Public Member Functions  
CollisionPair (const UserPointer *a, const btVector3 &contact_point_a, const UserPointer *b, const btVector3 &contact_point_b)  
The entries in Collision Pairs are sorted: if a projectile is included, it's always 'a'. More...  
bool  operator== (const CollisionPair &p) 
Tests if two collision pairs involve the same objects. More...  
const UserPointer *  getUserPointer (unsigned int n) const 
const Vec3 &  getContactPointCS (unsigned int n) const 
Returns the contact point of the collision in car (local) coordinates.  
Private Attributes  
const UserPointer *  m_up [2] 
The user pointer of the objects involved in this collision.  
Vec3  m_contact_point [2] 
The contact point for each object (in local coordincates).  
Bullet can report the same collision more than once (up to 4 contact points per collision.
Additionally, more than one internal substep might be taken, resulting in potentially even more duplicates. To handle this, all collisions (i.e. pair of objects) are stored in a vector, but only one entry per collision pair of objects. While this is a natural application of std::set, the set has some overhead (since it will likely use a tree to sort the entries). Considering that the number of collisions is usually rather small a simple list and linear search is faster is is being used here.

inline 
The entries in Collision Pairs are sorted: if a projectile is included, it's always 'a'.
If only two karts are reported the first kart pointer is the smaller one.

inline 
Tests if two collision pairs involve the same objects.
This test is simplified (i.e. no test if p.b==a and p.a==b) since the elements are sorted.