Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8108 in orxonox.OLD for branches/cr/src/lib


Ignore:
Timestamp:
Jun 1, 2006, 11:14:54 PM (19 years ago)
Author:
patrick
Message:

cr: double sidded collision events updated

Location:
branches/cr/src/lib/collision_reaction
Files:
4 edited

Legend:

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

    r7968 r8108  
    2929  this->entityA = NULL;
    3030  this->entityB = NULL;
     31
     32  this->bDispatched = false;
     33  this->entityACollide = false;
     34  this->entityBCollide = false;
    3135}
    3236
     
    4650{
    4751
    48 
     52  this->bDispatched = true;
    4953  this->flushCollisionEvents();
    5054}
     
    5660void Collision::flushCollisionEvents()
    5761{
     62  this->entityA = NULL;
     63  this->entityB = NULL;
     64
     65  this->entityACollide = false;
     66  this->entityBCollide = false;
     67
    5868  this->collisionEvents.clear();
    5969}
  • branches/cr/src/lib/collision_reaction/collision.h

    r8106 r8108  
    3131    inline WorldEntity* getEntityB() const { return this->entityB; }
    3232    /** @return true if Entity A collides */
    33     inline bool isEntityACollide() { return this->entityACollide; }
     33    inline bool isEntityACollide() const { return this->entityACollide; }
     34    /** sets the flag if it reacts @param flag true if it should react on entityA*/
     35    inline void setEntityACollide(bool flag) { this->entityACollide = flag; }
    3436    /** @return true if Entity B collides */
    35     inline bool isEntityBCollide() { return this->entityBCollide; }
     37    inline bool isEntityBCollide() const { return this->entityBCollide; }
     38    /** sets the flag if it reacts @param flag true if it should react on entityB*/
     39    inline void setEntityBCollide(bool flag) { this->entityACollide = flag; }
    3640
    3741    /** @returns true if this Collision has already been dispatched */
     
    3943
    4044    /** registers a @param event CollisionEvent to take place */
    41     inline void registerCollisionEvent(CollisionEvent* event) { this->collisionEvents.push_back(event); }
     45    inline void registerCollisionEvent(CollisionEvent* event) { this->collisionEvents.push_back(event); this->bDispatched = false;}
    4246    /** @returns a vector of collision events */
    4347    inline const std::vector<CollisionEvent*>& getCollisionEvents() const { return this->collisionEvents; }
    44 
    4548
    4649
  • branches/cr/src/lib/collision_reaction/collision_handle.cc

    r8107 r8108  
    9494
    9595  c->collide(entityA, entityB);
     96  c->setEntityACollide(true);
    9697  this->collisionList.push_back(c);
    9798
    9899  // now register it as a shared collision with the other collision entity
    99100  CollisionHandle* ch = entityB->getCollisionHandle(this->type);
    100   if( ch != NULL)
     101  if( ch != NULL) {
    101102    ch->registerSharedCollision(c);
     103    c->setEntityBCollide(true);
     104  }
    102105
    103106  return c;
  • branches/cr/src/lib/collision_reaction/cr_object_damage.cc

    r8106 r8108  
    5353{
    5454
    55   float mass;
    56   float velocity;
    57 
    58 
     55//   if(collision->)
    5956
    6057//   const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
Note: See TracChangeset for help on using the changeset viewer.