Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/bsp_model/src/lib/collision_reaction/collision_event.h @ 8203

Last change on this file since 8203 was 8203, checked in by patrick, 18 years ago

bsp: some mods

File size: 2.4 KB
Line 
1/*!
2 * @file collision_event.h
3 *  Definition of a collision event
4 */
5
6#ifndef _COLLISION_EVENT_H
7#define _COLLISION_EVENT_H
8
9#include "vector.h"
10
11class WorldEntity;
12class BoundingVolume;
13class Plane;
14
15
16//! A class representing a simple collision
17class CollisionEvent {
18
19 public:
20   CollisionEvent();
21  virtual ~CollisionEvent();
22
23  /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */
24  inline void collide(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)
25  { this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; }
26  /** collides two WorldEntities @param entity world entity , @param ground ground plane, @param position position on the ground */
27  inline void collide(WorldEntity* entity, Plane* ground, Vector position)
28  { this->entityA = entity; this->ground = ground; this->position = position; }
29
30
31  /** @return CollisionEvent WorldEntity A */
32  inline WorldEntity* getEntityA() const { return this->entityA; }
33  /** @return CollisionEvent WorldEntity B */
34  inline WorldEntity* getEntityB() const { return this->entityB; }
35  /** @return Bounding Volume from EntityA */
36  inline BoundingVolume* getBVA() const { return this->bvA; }
37  /** @return Bounding Volume from EntityB */
38  inline BoundingVolume* getBVB() const { return this->bvB; }
39
40  /** @return ground plane if collided with bsp model */
41  inline Plane* getGroundPlane() { return this->ground; }
42
43
44
45  inline void operator()(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) { this->collide(entityA, entityB, bvA, bvB); }
46  inline void operator()(WorldEntity* entity, Plane* ground, Vector position) { this->collide(entity, ground, position); }
47
48
49 private:
50  WorldEntity*      entityA;                       //!< the collision body A
51  WorldEntity*      entityB;                       //!< the collision body B
52
53  BoundingVolume*   bvA;                           //!< reference to the bounding volume A
54  BoundingVolume*   bvB;                           //!< reference to the bounding volume B
55
56  Plane*            ground;                        //!< the ground plane with which it collides (only for bsp-model collisions
57  Vector            position;                      //!< position of the collision on the ground plane
58};
59
60#endif /* _COLLISION_EVENT_H */
Note: See TracBrowser for help on using the repository browser.