Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9869 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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