Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Mezzanine::Physics::Collision Class Reference

This is an event class used to track collsions in the physics world. More...

#include <collision.h>

+ Collaboration diagram for Mezzanine::Physics::Collision:

Public Member Functions

 Collision ()
 Default Constructor.
 
 Collision (const Collision &Other)
 Copy Constructor. More...
 
virtual ~Collision ()
 Class Destructor. More...
 
virtual void _SetProxyA (CollidableProxy *A)
 Sets the first Collidable this collision applies to. More...
 
virtual void _SetProxyB (CollidableProxy *B)
 Sets the second Collidable this collision applies to. More...
 
virtual Whole GetAge (const Whole &Point)
 Gets the number of simulation steps the contact point has existed. More...
 
virtual Real GetAppliedImpulse (const Whole &Point)
 Gets the amount of force of the collision. More...
 
virtual Real GetDistance (const Whole &Point)
 Gets the penetration depth of the collision. More...
 
virtual Vector3 GetLocalALocation (const Whole &Point)
 Gets the location in ObjectA's local space where the collision occured. More...
 
virtual Vector3 GetLocalBLocation (const Whole &Point)
 Gets the location in ObjectB's local space where the collision occured. More...
 
virtual Vector3 GetNormal (const Whole &Point)
 GEts the collision normal for a contact point. More...
 
virtual Whole GetNumContactPoints ()
 Gets the number of contact points this collision is storing. More...
 
virtual WorldObjectGetObjectA () const
 Gets the parent Object of CollidableProxy A. More...
 
virtual WorldObjectGetObjectB () const
 Gets the parent Object of CollidableProxy B. More...
 
virtual CollidableProxyGetProxyA () const
 Gets the first CollidableProxy this collision applies to. More...
 
virtual CollidableProxyGetProxyB () const
 Gets the second CollidableProxy this collision applies to. More...
 
virtual Vector3 GetWorldLocation (const Whole &Point)
 Gets the location in the world where the collision occured. More...
 
virtual Boole PairsMatch (WorldObject *A, WorldObject *B) const
 Convenience function to see if the provided WorldObject pair match the pair in this class. More...
 
virtual Boole PairsMatch (CollidableProxy *A, CollidableProxy *B) const
 Convenience function to see if the provided CollidableProxy pair match the pair in this class. More...
 
virtual void Update ()
 Updates this collisions contact point data if it needs updating.
 

Protected Member Functions

 Collision (CollidableProxy *A, CollidableProxy *B, btCollisionAlgorithm *PhysicsAlgo)
 Class Constructor. More...
 
btManifoldPoint & GetManifoldPoint (const Whole &Index)
 Internal function responsible for fetching the appropriate contact point. More...
 
void UpdatePenetrationDistances ()
 Updates the PenetrationDistances vector on this object. More...
 

Protected Attributes

btCollisionAlgorithm * InternalAlgo
 The internal collision class this event is based on. More...
 
CollisionInternalDataInternalData
 Array of manifolds that apply to this collision. More...
 
std::vector< RealPenetrationDistances
 This stores the distance of each contact point in this collision, for using to track updates. More...
 
CollidableProxyProxyA
 The first CollidableProxy involved in the collision. More...
 
CollidableProxyProxyB
 The second CollidableProxy invovled in the collision. More...
 

Friends

class Mezzanine::Physics::CollisionDispatcher
 
class Mezzanine::Physics::ParallelCollisionDispatcher
 
class Mezzanine::Physics::PhysicsManager
 

Detailed Description

This is an event class used to track collsions in the physics world.

This class will be used for tracking collisions in the physics world and will keep track of basic data related to the collision. This class stores the information in the form of contact points. Often when a collision occurs there will be more then one place where the collision occured, this is a contact point. Internally collisions only store up to a maximum of 4 contact points. When querying for collision information, you have to provide the desired contact point index, and it must be valid. If the requested index isn't valid an exception will be thrown. So always make sure to verify with GetNumContactPoints().

Definition at line 72 of file collision.h.

Constructor & Destructor Documentation

Mezzanine::Physics::Collision::Collision ( CollidableProxy A,
CollidableProxy B,
btCollisionAlgorithm *  PhysicsAlgo 
)
protected

Class Constructor.

This will construct a basic event class with the minimum data needed.

Parameters
AThe first CollidableProxy involved in the collision.
BThe second CollidableProxy invovled in the collision.
PhysicsAlgoThe internal algorithm used for generating collision data.

Definition at line 67 of file collision.cpp.

Mezzanine::Physics::Collision::Collision ( const Collision Other)

Copy Constructor.

Parameters
OtherThe other Collision to copy

Definition at line 95 of file collision.cpp.

Mezzanine::Physics::Collision::~Collision ( )
virtual

Class Destructor.

Basic Class Destructor.

Definition at line 108 of file collision.cpp.

Member Function Documentation

void Mezzanine::Physics::Collision::_SetProxyA ( CollidableProxy A)
virtual

Sets the first Collidable this collision applies to.

Warning
Collision events can't/shouldn't have the bodies they apply to changed. This function exists mostly just for the blank constructor when you need to set them afterward. If you attempt to set this when the pointer is already set, it will log the event but otherwise silently fail.
Parameters
AThe first Object in this event.

Definition at line 259 of file collision.cpp.

void Mezzanine::Physics::Collision::_SetProxyB ( CollidableProxy B)
virtual

Sets the second Collidable this collision applies to.

Warning
Collision events can't/shouldn't have the bodies they apply to changed. This function exists mostly just for the blank constructor when you need to set them afterward. If you attempt to set this when the pointer is already set, it will log the event but otherwise silently fail.
Parameters
BThe second Object in this event.

Definition at line 270 of file collision.cpp.

Whole Mezzanine::Physics::Collision::GetAge ( const Whole Point)
virtual

Gets the number of simulation steps the contact point has existed.

Parameters
PointThe index of the contact point for this collision.
Returns
Returns a Whole representing the amount of simulation steps a point has existed.

Definition at line 253 of file collision.cpp.

Real Mezzanine::Physics::Collision::GetAppliedImpulse ( const Whole Point)
virtual

Gets the amount of force of the collision.

Parameters
PointThe index of the contact point for this collision.
Returns
Returns a real representing the amount of force applied from the collision.

Definition at line 247 of file collision.cpp.

Real Mezzanine::Physics::Collision::GetDistance ( const Whole Point)
virtual

Gets the penetration depth of the collision.

Remarks
You should double check the return of this to verify that it is <0, sometimes a collision or contact point can be reported while there is no actual overlap depending on your physics setup.
Parameters
PointThe index of the contact point for this collision.
Returns
Returns a real representing the depth of penetration between the two objects in this collision.

Definition at line 250 of file collision.cpp.

Vector3 Mezzanine::Physics::Collision::GetLocalALocation ( const Whole Point)
virtual

Gets the location in ObjectA's local space where the collision occured.

Parameters
PointThe index of the contact point for this collision.
Returns
Returns a vector3 with the point of the collision in ObjectA's local space.

Definition at line 238 of file collision.cpp.

Vector3 Mezzanine::Physics::Collision::GetLocalBLocation ( const Whole Point)
virtual

Gets the location in ObjectB's local space where the collision occured.

Parameters
PointThe index of the contact point for this collision.
Returns
Returns a vector3 with the point of the collision in ObjectB's local space.

Definition at line 241 of file collision.cpp.

btManifoldPoint & Mezzanine::Physics::Collision::GetManifoldPoint ( const Whole Index)
protected

Internal function responsible for fetching the appropriate contact point.

Definition at line 123 of file collision.cpp.

Vector3 Mezzanine::Physics::Collision::GetNormal ( const Whole Point)
virtual

GEts the collision normal for a contact point.

Parameters
PointThe index of the contact point for this collision.
Returns
Returns a vector3 representing the collision normal for a contact point.

Definition at line 244 of file collision.cpp.

Whole Mezzanine::Physics::Collision::GetNumContactPoints ( )
virtual

Gets the number of contact points this collision is storing.

Returns
Returns the number of contact points that currently exist for this collision.

Definition at line 228 of file collision.cpp.

WorldObject * Mezzanine::Physics::Collision::GetObjectA ( ) const
virtual

Gets the parent Object of CollidableProxy A.

Returns
Returns a pointer to the parent WorldObject of CollidableProxyA.

Definition at line 157 of file collision.cpp.

WorldObject * Mezzanine::Physics::Collision::GetObjectB ( ) const
virtual

Gets the parent Object of CollidableProxy B.

Returns
Returns a pointer to the parent WorldObject of CollidableProxyB.

Definition at line 160 of file collision.cpp.

CollidableProxy * Mezzanine::Physics::Collision::GetProxyA ( ) const
virtual

Gets the first CollidableProxy this collision applies to.

Returns
Returns a pointer to the first CollidableProxy in this event.

Definition at line 151 of file collision.cpp.

CollidableProxy * Mezzanine::Physics::Collision::GetProxyB ( ) const
virtual

Gets the second CollidableProxy this collision applies to.

Returns
Returns a pointer to the second CollidableProxy in this event.

Definition at line 154 of file collision.cpp.

Vector3 Mezzanine::Physics::Collision::GetWorldLocation ( const Whole Point)
virtual

Gets the location in the world where the collision occured.

Parameters
PointThe index of the contact point for this collision.
Returns
Returns a vector3 containing the approximate world location of the collision.

Definition at line 231 of file collision.cpp.

Boole Mezzanine::Physics::Collision::PairsMatch ( WorldObject A,
WorldObject B 
) const
virtual

Convenience function to see if the provided WorldObject pair match the pair in this class.

Parameters
AThe first WorldObject to be compared. Will be checked against both objects in this collision.
BThe second WorldObject to be compared. Will be checked against both objects in this collision.
Returns
Returns a Boole, true if the pairs match, false otherwise.

Definition at line 163 of file collision.cpp.

Boole Mezzanine::Physics::Collision::PairsMatch ( CollidableProxy A,
CollidableProxy B 
) const
virtual

Convenience function to see if the provided CollidableProxy pair match the pair in this class.

Parameters
AThe first CollidableProxy to be compared. Will be checked against both objects in this collision.
BThe second CollidableProxy to be compared. Will be checked against both objects in this collision.
Returns
Returns a Boole, true if the pairs match, false otherwise.

Definition at line 176 of file collision.cpp.

void Mezzanine::Physics::Collision::UpdatePenetrationDistances ( )
protected

Updates the PenetrationDistances vector on this object.

Definition at line 137 of file collision.cpp.

Member Data Documentation

btCollisionAlgorithm* Mezzanine::Physics::Collision::InternalAlgo
protected

The internal collision class this event is based on.

Definition at line 81 of file collision.h.

CollisionInternalData* Mezzanine::Physics::Collision::InternalData
protected

Array of manifolds that apply to this collision.

Definition at line 84 of file collision.h.

std::vector<Real> Mezzanine::Physics::Collision::PenetrationDistances
protected

This stores the distance of each contact point in this collision, for using to track updates.

Definition at line 93 of file collision.h.

CollidableProxy* Mezzanine::Physics::Collision::ProxyA
protected

The first CollidableProxy involved in the collision.

Definition at line 87 of file collision.h.

CollidableProxy* Mezzanine::Physics::Collision::ProxyB
protected

The second CollidableProxy invovled in the collision.

Definition at line 90 of file collision.h.


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