Changeset 7967 in orxonox.OLD for branches/cr/src/lib/collision_reaction
- Timestamp:
- May 30, 2006, 1:22:05 AM (19 years ago)
- Location:
- branches/cr/src/lib/collision_reaction
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cr/src/lib/collision_reaction/collision_handle.cc
r7966 r7967 74 74 /** 75 75 * registers a new Collision Object 76 * if a there is already a collision object with the same stats 77 * registration will be skipped and the last collision object is returned 76 78 */ 77 79 Collision* CollisionHandle::registerCollision(WorldEntity* entityA, WorldEntity* entityB) 78 80 { 79 // get the new collision object 80 Collision* c = CREngine::getInstance()->popCollisionObject(); 81 //first get the collision object, multiple sources 82 Collision* c; 83 if( this->collisionList.empty() || 84 ((this->collisionList.back())->getEntityA() != entityA && (this->collisionList.back())->getEntityB() != entityB )) 85 c = CREngine::getInstance()->popCollisionObject(); 86 else 87 c = this->collisionList.back(); 81 88 82 c->collide( collisionEvent->getEntityA(), collisionEvent->getEntityB());89 c->collide(entityA, entityB); 83 90 this->collisionList.push_back(c); 91 92 return c; 84 93 } 85 94 … … 92 101 { 93 102 // first element only 94 if( this->collisionList.empty()) 95 { 96 return; 97 } 98 99 if( ((this->collisionList.back())->getEntityA() == collisionEvent->getEntityA()) && 100 ((this->collisionList.back())->getEntityB() == collisionEvent->getEntityB())) 101 { 102 (this->collisionList.back())->registerCollisionEvent(collisionEvent); 103 } 103 Collision* c = this->registerCollision(collisionEvent->getEntityA(), collisionEvent->getEntityB()); 104 c->registerCollisionEvent(collisionEvent); 104 105 } 105 106 -
branches/cr/src/lib/collision_reaction/collision_handle.h
r7966 r7967 29 29 30 30 void addTarget(long classID); 31 Collision registerCollision(WorldEntity* entityA, WorldEntity* entityB);31 Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB); 32 32 void registerCollisionEvent(CollisionEvent* collisionEvent); 33 33 /** @returns true if regiestered some new collision events in this tick frame */ -
branches/cr/src/lib/collision_reaction/cr_engine.cc
r7966 r7967 149 149 } 150 150 151 151 152 /** 152 153 * flushes all the collision lists and puts them to their initial state 153 154 */ 154 void CREng eine::flushCollisions()155 void CREngine::flushCollisions() 155 156 { 157 vector<Collision*>::iterator it = this->collisionsUsed.begin(); 158 for(; it < this->collisionsUsed.end(); it++) 159 this->collisionsUnused.push_back(*it); 156 160 161 this->collisionsUsed.clear(); 157 162 } 158 163
Note: See TracChangeset
for help on using the changeset viewer.