Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/coll_rect/src/lib/collision_reaction/collision_handle.h @ 9893

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

collision reactions now only registered with collision tube. no compile

File size: 2.4 KB
RevLine 
[7841]1/*!
2 * @file collision_handle.h
[9888]3 * @brief Definition of a collision handle: used for accessing per world entity collision events and reactions
[7841]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;
[7841]18
[9889]19namespace CoRe
20{
[7927]21
[9889]22  class CollisionReaction;
[7927]23
[9889]24
25
26  //! A class for defining collision reactions and storing events
27  class CollisionHandle : public BaseObject
28  {
29    ObjectListDeclaration(CollisionHandle);
[9890]30
[8190]31  public:
[9892]32    CollisionHandle(WorldEntity* owner, CREngine::ReactionType type);
[8190]33    virtual ~CollisionHandle();
[7841]34
[8190]35    void reset();
[7927]36
[9869]37    void addTarget(const ClassID& target);
[7927]38
[8190]39    /** @returns true if regiestered some new collision events in this tick frame */
40    inline bool isCollided() const { return this->bCollided; }
41    /** @returns true if this collision handle has already been dispatched */
42    inline bool isDispatched() const { return this->bDispatched; }
43    /** @returns true if this handle should be pulled also if there are no collisions */
44    inline bool isContinuousPoll() const { return this->bContinuousPoll; }
[8490]45    /** @returns the type */
[9892]46    inline CREngine::ReactionType getType() const { return this->type; }
[7841]47
[8190]48    void handleCollisions();
[7841]49
50
[8190]51  private:
52    void flushCollisions();
53    bool filterCollisionEvent(CollisionEvent* collisionEvent);
54    bool filterCollision(Collision* collision);
[7841]55
56
57
[8190]58  private:
59    WorldEntity*                  owner;                   //!< the worldenity this reaction will be applied on
[9892]60    CREngine::ReactionType              type;                    //!< the reaction type
[8190]61
62    bool                          bContinuousPoll;         //!< if this is true
63    bool                          bDispatched;             //!< true if this handle has already been dispatched
64    bool                          bStopOnFirstCollision;   //!< true if the cd of this object should be terminated after one match
65    bool                          bCollided;               //!< true if the CollsionHandle has registered some new collisions
66
67    std::vector<Collision*>       collisionList;           //!< a list full of collisions
[9869]68    std::vector<ClassID>          targetList;              //!< a list of target classes for filtering @TODO TAKE SET INSTEAD OF VECTOR HERE
[8190]69
70    CollisionReaction*            collisionReaction;       //!< reference to the collision reaction object
71
[9889]72  };
[7841]73
[9889]74}
[7841]75#endif /* _COLLISION_HANDLE_H */
Note: See TracBrowser for help on using the repository browser.