Changeset 8490 in orxonox.OLD for trunk/src/lib/collision_reaction/collision_handle.cc
- Timestamp:
- Jun 15, 2006, 9:34:48 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_reaction/collision_handle.cc
r8362 r8490 24 24 25 25 #include "cr_object_damage.h" 26 #include "cr_physics_ground_walk.h" 26 27 27 28 #include "debug.h" … … 42 43 43 44 this->bCollided = false; 44 this->bDispatched = false; 45 46 if( this->type == CREngine::CR_PHYSICS_STEP_BACK) 47 this->bContinuousPoll = false; 48 else 49 this->bContinuousPoll = true; 50 51 if( this->type == CREngine::CR_OBJECT_DAMAGE) 52 this->bStopOnFirstCollision = true; 53 else 54 this->bStopOnFirstCollision = false; 45 this->bDispatched = true; 46 47 this->collisionReaction = NULL; 48 this->bContinuousPoll = false; 49 this->bStopOnFirstCollision = false; 50 55 51 56 52 switch( type) 57 53 { 54 case CREngine::CR_PHYSICS_STEP_BACK: 55 // this->collisionReaction = new CRPhysicsGroundWalk(); 56 this->bContinuousPoll = true; 57 break; 58 case CREngine::CR_PHYSICS_GROUND_WALK: 59 this->collisionReaction = new CRPhysicsGroundWalk(); 60 this->bContinuousPoll = true; 61 break; 58 62 case CREngine::CR_OBJECT_DAMAGE: 59 63 this->collisionReaction = new CRObjectDamage(); 64 this->bStopOnFirstCollision = true; 60 65 break; 61 66 default: … … 71 76 { 72 77 // delete what has to be deleted here 78 if( this->collisionReaction != NULL) 79 delete this->collisionReaction; 73 80 } 74 81 … … 169 176 170 177 c->registerCollisionEvent(collisionEvent); 178 PRINTF(0)("Registering Collision Event: %s, %s\n", collisionEvent->getEntityA()->getClassName(), collisionEvent->getEntityB()->getClassName()); 171 179 } 172 180 … … 186 194 void CollisionHandle::handleCollisions() 187 195 { 196 // if continuous poll poll the reaction 197 if( this->bContinuousPoll && !this->bCollided) 198 { 199 this->collisionReaction->update(this->owner); 200 return; 201 } 202 188 203 // collision reaction calculations (for every collision there will be a reaction) 189 204 vector<Collision*>::iterator it = this->collisionList.begin(); … … 214 229 { 215 230 if( collisionEvent->getEntityA() == this->owner) { 216 if( collisionEvent->getEntityA()->isA((ClassID)(*it))) 231 if( collisionEvent->getEntityB()->isA((ClassID)(*it))) { 232 PRINTF(0)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(), 233 collisionEvent->getEntityB()->getClassName(), *it); 217 234 return true; } 235 } 218 236 else { 219 if( collisionEvent->getEntityB()->isA((ClassID)(*it))) 220 return true; } 237 if( collisionEvent->getEntityA()->isA((ClassID)(*it))) { 238 PRINTF(0)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(), 239 collisionEvent->getEntityA()->getClassName(), *it); 240 return true; } 241 } 221 242 } 222 243
Note: See TracChangeset
for help on using the changeset viewer.