Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/collision_reaction/collision_event.h @ 9475

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

merged the branche single_player_map with the trunk

File size: 2.8 KB
RevLine 
[7959]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
[8894]11#include "cr_defs.h"
12
13
[7959]14class WorldEntity;
15class BoundingVolume;
[8182]16class Plane;
[7959]17
18
[8894]19
[7959]20//! A class representing a simple collision
21class CollisionEvent {
22
23 public:
24   CollisionEvent();
25  virtual ~CollisionEvent();
26
27  /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */
[8894]28  inline void collide(int type, WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)
29  { this->collisionType = type; this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; }
[8182]30  /** collides two WorldEntities @param entity world entity , @param ground ground plane, @param position position on the ground */
[8894]31  inline void collide(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall)
32  { this->collisionType = type; this->entityA = entity; this->entityB = groundEntity, this->groundNormal = normal; this->position = position; this->bInWall = bInWall; }
[7959]33
34
35  /** @return CollisionEvent WorldEntity A */
[7964]36  inline WorldEntity* getEntityA() const { return this->entityA; }
[7959]37  /** @return CollisionEvent WorldEntity B */
[7964]38  inline WorldEntity* getEntityB() const { return this->entityB; }
[7959]39  /** @return Bounding Volume from EntityA */
[7964]40  inline BoundingVolume* getBVA() const { return this->bvA; }
[7959]41  /** @return Bounding Volume from EntityB */
[7964]42  inline BoundingVolume* getBVB() const { return this->bvB; }
[7959]43
[8490]44  /** @return ground plane if collided with bsp model */
45  inline Vector getGroundNormal() { return this->groundNormal; }
[7959]46
[8490]47  /** @return position of the position, only accurate if this is a collision with the ground!!! */
48  inline Vector getCollisionPosition() { return this->position; }
[8182]49
[8894]50  /** @return the type of the collision */
51  inline int getType() { return this->collisionType; }
52
53  /** @return true if the entity is in the wall */
54  inline bool isInWall() { return this->bInWall; }
55
56
[7959]57 private:
58  WorldEntity*      entityA;                       //!< the collision body A
59  WorldEntity*      entityB;                       //!< the collision body B
60
[8028]61  BoundingVolume*   bvA;                           //!< reference to the bounding volume A
62  BoundingVolume*   bvB;                           //!< reference to the bounding volume B
[8182]63
[8490]64  Vector            groundNormal;                  //!< the ground plane with which it collides (only for bsp-model collisions
[8182]65  Vector            position;                      //!< position of the collision on the ground plane
[8894]66
67  bool              bInWall;                       //!< true if is in wall
68  int               collisionType;                 //!< collision type
[7959]69};
70
71#endif /* _COLLISION_EVENT_H */
Note: See TracBrowser for help on using the repository browser.