Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7947 in orxonox.OLD


Ignore:
Timestamp:
May 29, 2006, 1:12:19 AM (18 years ago)
Author:
patrick
Message:

cr: integraged the collision reaction into the main loop

Location:
branches/cr/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/cr/src/lib/collision_reaction/collision_handle.cc

    r7946 r7947  
    102102  // now set state to dispatched
    103103  this->bDispatched = true;
     104  this->bCollided = false;
    104105  this->flushCollisions();
    105106}
  • branches/cr/src/lib/collision_reaction/collision_handle.h

    r7946 r7947  
    3131    void addTarget(long classID);
    3232    void registerCollision(Collision* collision);
     33    /** @returns true if regiestered some new collision events in this tick frame */
     34    inline bool isCollided() const { return this->bCollided; }
    3335
    3436    void handleCollisions();
     
    4547    bool                          bDispatched;             //!< true if this handle has already been dispatched
    4648    bool                          bStopOnFirstCollision;   //!< true if the cd of this object should be terminated after one match
     49    bool                          bCollided;               //!< true if the CollsionHandle has registered some new collisions
    4750
    4851    std::vector<Collision*>       collisionList;           //!< a list full of collisions
  • branches/cr/src/lib/collision_reaction/cr_engine.cc

    r7946 r7947  
    115115
    116116void CREngine::handleCollisions()
    117 {}
     117{
     118  std::vector<CollisionHandle*>::iterator it;
     119  for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)
     120  {
     121    if( (*it)->isCollided())
     122    {
     123      (*it)->handleCollisions();
     124    }
     125  }
     126}
    118127
    119128
  • branches/cr/src/story_entities/game_world.cc

    r7919 r7947  
    278278    /* process time */
    279279    this->tick ();
    280     /* process collision */
    281     this->collide ();
     280    /* collision detection */
     281    this->collisionDetection ();
     282    /* collision reaction */
     283    this->collisionReaction ();
    282284    /* update the state */
    283285    this->update ();
     
    408410 * kicks the CDEngine to detect the collisions between the object groups in the world
    409411 */
    410 void GameWorld::collide()
     412void GameWorld::collisionDetection()
    411413{
    412414  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
     
    422424      this->dataTank->objectManager->getObjectList(OM_COMMON));
    423425
     426}
     427
     428
     429void GameWorld::collisionReaction()
     430{
     431  CREngine::getInstance()->handleCollisions();
    424432}
    425433
  • branches/cr/src/story_entities/game_world.h

    r7919 r7947  
    6868    virtual void update();
    6969    virtual void checkGameRules();
    70     virtual void collide();
     70    virtual void collisionDetection();
     71    virtual void collisionReaction();
    7172
    7273    void drawEntityList(const ObjectManager::EntityList& drawList ) const;
Note: See TracChangeset for help on using the changeset viewer.