Changeset 9889 in orxonox.OLD for branches/coll_rect/src/lib/collision_reaction/collision_event.h
- Timestamp:
- Oct 13, 2006, 3:57:44 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/coll_rect/src/lib/collision_reaction/collision_event.h
r9888 r9889 22 22 class Plane; 23 23 24 namespace CoRe 25 { 26 27 //! A class representing a simple collision 28 class CollisionEvent 29 { 30 public: 31 CollisionEvent(); 32 virtual ~CollisionEvent(); 33 34 /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */ 35 inline void collide(int type, WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) 36 { this->collisionType = type; this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; } 37 /** collides two WorldEntities @param entity world entity , @param ground ground plane, @param position position on the ground */ 38 inline void collide(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall) 39 { 40 this->collisionType = type; 41 this->entityA = entity; 42 this->entityB = groundEntity; 43 this->groundNormal = normal; 44 this->position = position; 45 this->bInWall = bInWall; 46 } 24 47 25 48 26 //! A class representing a simple collision 27 class CollisionEvent { 28 public: 29 CollisionEvent(); 30 virtual ~CollisionEvent(); 49 /** @return CollisionEvent WorldEntity A */ 50 inline WorldEntity* getEntityA() const 51 { 52 return this->entityA; 53 } 54 /** @return CollisionEvent WorldEntity B */ 55 inline WorldEntity* getEntityB() const 56 { 57 return this->entityB; 58 } 59 /** @return Bounding Volume from EntityA */ 60 inline BoundingVolume* getBVA() const 61 { 62 return this->bvA; 63 } 64 /** @return Bounding Volume from EntityB */ 65 inline BoundingVolume* getBVB() const 66 { 67 return this->bvB; 68 } 31 69 32 /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */ 33 inline void collide(int type, WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) 34 { this->collisionType = type; this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; } 35 /** collides two WorldEntities @param entity world entity , @param ground ground plane, @param position position on the ground */ 36 inline void collide(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall) 37 { this->collisionType = type; this->entityA = entity; this->entityB = groundEntity, this->groundNormal = normal; this->position = position; this->bInWall = bInWall; } 70 /** @return ground plane if collided with bsp model */ 71 inline Vector getGroundNormal() 72 { 73 return this->groundNormal; 74 } 75 76 /** @return position of the position, only accurate if this is a collision with the ground!!! */ 77 inline Vector getCollisionPosition() 78 { 79 return this->position; 80 } 81 82 /** @return the type of the collision */ 83 inline int getType() 84 { 85 return this->collisionType; 86 } 87 88 /** @return true if the entity is in the wall */ 89 inline bool isInWall() 90 { 91 return this->bInWall; 92 } 38 93 39 94 40 /** @return CollisionEvent WorldEntity A */ 41 inline WorldEntity* getEntityA() const { return this->entityA; } 42 /** @return CollisionEvent WorldEntity B */ 43 inline WorldEntity* getEntityB() const { return this->entityB; } 44 /** @return Bounding Volume from EntityA */ 45 inline BoundingVolume* getBVA() const { return this->bvA; } 46 /** @return Bounding Volume from EntityB */ 47 inline BoundingVolume* getBVB() const { return this->bvB; } 95 private: 96 WorldEntity* entityA; //!< the collision body A 97 WorldEntity* entityB; //!< the collision body B 48 98 49 /** @return ground plane if collided with bsp model */50 inline Vector getGroundNormal() { return this->groundNormal; }99 BoundingVolume* bvA; //!< reference to the bounding volume A 100 BoundingVolume* bvB; //!< reference to the bounding volume B 51 101 52 /** @return position of the position, only accurate if this is a collision with the ground!!! */53 inline Vector getCollisionPosition() { return this->position; }102 Vector groundNormal; //!< the ground plane with which it collides (only for bsp-model collisions 103 Vector position; //!< position of the collision on the ground plane 54 104 55 /** @return the type of the collision */ 56 inline int getType() { return this->collisionType; } 105 bool bInWall; //!< true if is in wall 106 int collisionType; //!< collision type 107 }; 57 108 58 /** @return true if the entity is in the wall */ 59 inline bool isInWall() { return this->bInWall; } 60 61 62 private: 63 WorldEntity* entityA; //!< the collision body A 64 WorldEntity* entityB; //!< the collision body B 65 66 BoundingVolume* bvA; //!< reference to the bounding volume A 67 BoundingVolume* bvB; //!< reference to the bounding volume B 68 69 Vector groundNormal; //!< the ground plane with which it collides (only for bsp-model collisions 70 Vector position; //!< position of the collision on the ground plane 71 72 bool bInWall; //!< true if is in wall 73 int collisionType; //!< collision type 74 }; 75 109 } 76 110 #endif /* _COLLISION_EVENT_H */
Note: See TracChangeset
for help on using the changeset viewer.