Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

cr: more bugs removed, more safty added

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