Changeset 8124 in orxonox.OLD for branches/cr/src
- Timestamp:
- Jun 3, 2006, 2:36:03 PM (19 years ago)
- Location:
- branches/cr/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cr/src/lib/collision_reaction/collision.cc
r8108 r8124 66 66 this->entityBCollide = false; 67 67 68 this->bDispatched = false; 69 68 70 this->collisionEvents.clear(); 69 71 } -
branches/cr/src/lib/collision_reaction/collision.h
r8108 r8124 2 2 * @file collision.h 3 3 * Definition of a collision as a two WE hit each other 4 * 5 * A is shared between two WorldEntity's CollisionHandles if both are subscribed to this event. In this case only one 6 * of the two CollisionHandles will calculate the CollisionReaction and the bDispatched flag will be set afterwards 7 * to signal that it's already cared about and should be ignored. 4 8 */ 5 9 -
branches/cr/src/lib/collision_reaction/collision_handle.cc
r8110 r8124 80 80 /** 81 81 * registers a new Collision Object 82 * @param entityA WorldEntity A of the collision 83 * @param entityB WorldEntity B of the collision 82 84 * if a there is already a collision object with the same stats 83 85 * registration will be skipped and the last collision object is returned … … 97 99 // now register it as a shared collision with the other collision entity 98 100 CollisionHandle* ch = entityB->getCollisionHandle(this->type); 99 if( ch != NULL) {101 if( ch != NULL) 100 102 ch->registerSharedCollision(c); 101 c->setEntityBCollide(true);102 }103 103 104 104 return c; … … 134 134 this->bDispatched = false; 135 135 136 // first element only136 // checks if these WorldEntities have already collided or if its a new collision -> create a new Collision object 137 137 Collision* c = this->registerCollision(collisionEvent->getEntityA(), collisionEvent->getEntityB()); 138 138 c->setEntityACollide(true); … … 178 178 vector<long>::iterator it = this->targetList.begin(); 179 179 for(; it < this->targetList.end(); it++) 180 { 181 if( !collisionEvent->getEntityA()->isA((ClassID)(*it))) 182 return false; 183 } 180 if( collisionEvent->getEntityA()->isA((ClassID)(*it))) 181 return true; 184 182 185 return true;183 return false; 186 184 } 187 185 -
branches/cr/src/world_entities/world_entity.cc
r7989 r8124 323 323 this->collisionHandles[type] = CREngine::getInstance()->subscribeReaction(this, type); 324 324 325 // now there is at least one collision reaction subs ribed325 // now there is at least one collision reaction subscribed 326 326 this->bReactive = true; 327 327 } … … 379 379 // create a collision event 380 380 CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject(); 381 assert(c != NULL); 381 assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h 382 382 c->collide(entityA, entityB, bvA, bvB); 383 383 384 for( int i = 0; i < CREngine::CR_NUMBER; ++i)384 for( int i = 0; i < CREngine::CR_NUMBER; ++i) 385 385 if( this->collisionHandles[i] != NULL) 386 386 this->collisionHandles[i]->registerCollisionEvent(c);
Note: See TracChangeset
for help on using the changeset viewer.