/*! * @file collision_event.h * Definition of a collision event */ #ifndef _COLLISION_EVENT_H #define _COLLISION_EVENT_H #include "vector.h" class WorldEntity; class BoundingVolume; class Plane; //! A class representing a simple collision class CollisionEvent { public: CollisionEvent(); virtual ~CollisionEvent(); /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */ inline void collide(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) { this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; } /** collides two WorldEntities @param entity world entity , @param ground ground plane, @param position position on the ground */ inline void collide(WorldEntity* entity, Vector normal, Vector position) { this->entityA = entity; this->groundNormal = normal; this->position = position; } /** @return CollisionEvent WorldEntity A */ inline WorldEntity* getEntityA() const { return this->entityA; } /** @return CollisionEvent WorldEntity B */ inline WorldEntity* getEntityB() const { return this->entityB; } /** @return Bounding Volume from EntityA */ inline BoundingVolume* getBVA() const { return this->bvA; } /** @return Bounding Volume from EntityB */ inline BoundingVolume* getBVB() const { return this->bvB; } /** @return ground plane if collided with bsp model */ inline Vector getGroundNormal() { return this->groundNormal; } private: WorldEntity* entityA; //!< the collision body A WorldEntity* entityB; //!< the collision body B BoundingVolume* bvA; //!< reference to the bounding volume A BoundingVolume* bvB; //!< reference to the bounding volume B Vector groundNormal; //!< the ground plane with which it collides (only for bsp-model collisions Vector position; //!< position of the collision on the ground plane }; #endif /* _COLLISION_EVENT_H */