Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/collision_reaction/collision_handle.h @ 8317

Last change on this file since 8317 was 8190, checked in by patrick, 19 years ago

trunk: merged the cr branche to trunk

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