Changeset 7969 in orxonox.OLD for branches/cr
- Timestamp:
- May 30, 2006, 1:33:09 AM (19 years ago)
- Location:
- branches/cr/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cr/src/lib/collision_reaction/collision_handle.cc
r7967 r7969 120 120 void CollisionHandle::handleCollisions() 121 121 { 122 123 // collision reaction calculations 122 // collision reaction calculations (for every collision there will be a reaction) 123 vector<Collision*>::iterator it = this->collisionList.begin(); 124 for(; it < this->collisionList.end(); it++) 125 { 126 (*it)->handleCollisionEvents(); 127 } 124 128 125 129 // now set state to dispatched -
branches/cr/src/world_entities/world_entity.cc
r7958 r7969 33 33 34 34 #include "collision_handle.h" 35 #include "collision .h"35 #include "collision_event.h" 36 36 37 37 #include <stdarg.h> … … 73 73 for(int i = 0; i < CREngine::CR_NUMBER; ++i) 74 74 this->collisionHandles[i] = NULL; 75 this->bReactive = false; 75 76 76 77 this->toList(OM_NULL); … … 280 281 this->collisionHandles[type] = NULL; 281 282 282 // 283 // check if there is still any handler registered 284 for(int i = 0; i < CREngine::CR_NUMBER; ++i) 285 { 286 if( this->collisionHandles[i] != NULL) 287 { 288 this->bReactive = true; 289 return; 290 } 291 } 292 this->bReactive = false; 283 293 } 284 294 … … 292 302 this->unsubscribeReaction((CREngine::CRType)i); 293 303 304 // there are no reactions subscribed from now on 294 305 this->bReactive = false; 295 306 } … … 302 313 bool WorldEntity::registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) 303 314 { 315 // is there any handler listening? 316 if( !this->bReactive) 317 return false; 318 304 319 PRINTF(0)("Registering Collision: %s vs %s \n", entityA->getClassName(), entityB->getClassName()); 305 320 // create a collision event 306 Collision * c = CREngine::getInstance()->popCollisionObject();321 CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject(); 307 322 assert(c != NULL); 308 323 c->collide(entityA, entityB, bvA, bvB); … … 310 325 for(int i = 0; i < CREngine::CR_NUMBER; ++i) 311 326 if( this->collisionHandles[i] != NULL) 312 this->collisionHandles[i]->registerCollision (c);327 this->collisionHandles[i]->registerCollisionEvent(c); 313 328 } 314 329
Note: See TracChangeset
for help on using the changeset viewer.