Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/cr/src/lib/collision_reaction/collision_handle.h @ 8109

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

cr: one sideded filter for collision events

File size: 2.2 KB
Line 
1/*!
2 * @file collision_handle.h
3 * @brief Definition of a collision handle: used for accesing per world entity collision events and reactions
4*/
5
6#ifndef _COLLISION_HANDLE_H
7#define _COLLISION_HANDLE_H
8
9#include "base_object.h"
10#include "cr_engine.h"
11
12#include <vector>
13#include <list>
14
15
16class Collision;
17class WorldEntity;
18
19
20
21//! A class for defining collision reactions and storing events
22class CollisionHandle : public BaseObject
23{
24
25  public:
26    CollisionHandle(WorldEntity* owner, CREngine::CRType type);
27    virtual ~CollisionHandle();
28
29    void reset();
30
31    void addTarget(long target);
32    Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB);
33    void registerSharedCollision(Collision* collision);
34    void registerCollisionEvent(CollisionEvent* collisionEvent);
35
36    /** @returns true if regiestered some new collision events in this tick frame */
37    inline bool isCollided() const { return this->bCollided; }
38    /** @returns true if this collision handle has already been dispatched */
39    inline bool isDispatched() const { return this->bDispatched; }
40    /** @returns true if this handle should be pulled also if there are no collisions */
41    inline bool isContinuousPoll() const { return this->bContinuousPoll; }
42
43    void handleCollisions();
44
45
46  private:
47    void flushCollisions();
48    bool filterCollisionEvent(CollisionEvent* collisionEvent);
49
50
51  private:
52    WorldEntity*                  owner;                   //!< the worldenity this reaction will be applied on
53    CREngine::CRType              type;                    //!< the reaction type
54
55    bool                          bContinuousPoll;         //!< if this is true
56    bool                          bDispatched;             //!< true if this handle has already been dispatched
57    bool                          bStopOnFirstCollision;   //!< true if the cd of this object should be terminated after one match
58    bool                          bCollided;               //!< true if the CollsionHandle has registered some new collisions
59
60    std::vector<Collision*>       collisionList;           //!< a list full of collisions
61    std::vector<long>             targetList;              //!< a list of target classes for filtering
62
63};
64
65#endif /* _COLLISION_HANDLE_H */
Note: See TracBrowser for help on using the repository browser.