40 #ifndef _physicscollision_cpp
41 #define _physicscollision_cpp
43 #include "collision.h"
44 #include "worldobject.h"
47 #include "stringtool.h"
49 #include "Physics/physicsenumerations.h"
50 #include "Physics/collidableproxy.h"
52 #include <btBulletDynamicsCommon.h>
68 InternalAlgo(PhysicsAlgo),
96 InternalAlgo(Other.InternalAlgo),
129 Whole SuperIndex = Index/4;
130 Whole SubIndex = Index%4;
168 Boole ContainsA = ( A == ObjA ) || ( A == ObjB );
169 Boole ContainsB = ( B == ObjA ) || ( B == ObjB );
170 return (ContainsA && ContainsB);
180 return (ContainsA && ContainsB);
204 for(
Whole X = 0 ; X < NumManifolds ; ++X )
235 return Vector3((PointA+PointB) /= 2);
virtual void _NotifyCollisionState(Physics::Collision *Col, const Physics::CollisionState State)
Notifies this World Object of a collision that is occuring with it.
virtual Whole GetAge(const Whole &Point)
Gets the number of simulation steps the contact point has existed.
bool Boole
Generally acts a single bit, true or false.
virtual Real GetAppliedImpulse(const Whole &Point)
Gets the amount of force of the collision.
Collision()
Default Constructor.
virtual Real GetDistance(const Whole &Point)
Gets the penetration depth of the collision.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
virtual void _SetProxyA(CollidableProxy *A)
Sets the first Collidable this collision applies to.
int Integer
A datatype used to represent any integer close to.
virtual WorldObject * GetObjectA() const
Gets the parent Object of CollidableProxy A.
virtual Vector3 GetWorldLocation(const Whole &Point)
Gets the location in the world where the collision occured.
btManifoldPoint & GetManifoldPoint(const Whole &Index)
Internal function responsible for fetching the appropriate contact point.
float Real
A Datatype used to represent a real floating point number.
virtual CollidableProxy * GetProxyA() const
Gets the first CollidableProxy this collision applies to.
This is the base class from which classes that are insertable into the physical world.
std::vector< Real > PenetrationDistances
This stores the distance of each contact point in this collision, for using to track updates...
virtual void Update()
Updates this collisions contact point data if it needs updating.
Used to insulate the interface from the implementation details for bullet.
virtual Boole PairsMatch(WorldObject *A, WorldObject *B) const
Convenience function to see if the provided WorldObject pair match the pair in this class...
void UpdatePenetrationDistances()
Updates the PenetrationDistances vector on this object.
This is an event class used to track collsions in the physics world.
virtual WorldObject * GetObjectB() const
Gets the parent Object of CollidableProxy B.
CollidableProxy * ProxyB
The second CollidableProxy invovled in the collision.
virtual Vector3 GetNormal(const Whole &Point)
GEts the collision normal for a contact point.
btManifoldArray Manifolds
Wrapped Data, An array of Collision Manifolds.
This is a proxy from which physics objects that can collide with each other are handled.
virtual ~Collision()
Class Destructor.
virtual CollidableProxy * GetProxyB() const
Gets the second CollidableProxy this collision applies to.
CollidableProxy * ProxyA
The first CollidableProxy involved in the collision.
This is used to represent a point in space, or a vector through space.
virtual Whole GetNumContactPoints()
Gets the number of contact points this collision is storing.
CollisionInternalData * InternalData
Array of manifolds that apply to this collision.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
virtual WorldObject * GetParentObject() const
Gets a pointer to the parent object controlling this proxy.
btCollisionAlgorithm * InternalAlgo
The internal collision class this event is based on.
virtual Vector3 GetLocalALocation(const Whole &Point)
Gets the location in ObjectA's local space where the collision occured.
Thrown when attempted to access something that really should note be accessed.
virtual Vector3 GetLocalBLocation(const Whole &Point)
Gets the location in ObjectB's local space where the collision occured.
virtual void _SetProxyB(CollidableProxy *B)
Sets the second Collidable this collision applies to.