Changeset 8256 in orxonox.OLD for branches/bsp_model/src/lib/collision_reaction
- Timestamp:
- Jun 8, 2006, 3:47:40 PM (18 years ago)
- Location:
- branches/bsp_model/src/lib/collision_reaction
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/collision_reaction/collision.h
r8203 r8256 27 27 28 28 /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */ 29 inline void collide(WorldEntity* entityA, WorldEntity* entityB) { this->entityA = entityA; this->entityB = entityB; }29 inline void collide(WorldEntity* entityA, WorldEntity* entityB) { this->entityA = entityA; this->entityB = entityB; this->bDispatched = false; } 30 30 31 31 -
branches/bsp_model/src/lib/collision_reaction/collision_handle.cc
r8220 r8256 41 41 42 42 this->bCollided = false; 43 this->bDispatched = false;43 this->bDispatched = true; 44 44 45 45 this->collisionReaction = NULL; 46 this->bContinuousPoll = true;46 this->bContinuousPoll = false; 47 47 this->bStopOnFirstCollision = false; 48 48 … … 56 56 case CREngine::CR_PHYSICS_GROUND_WALK: 57 57 this->collisionReaction = new CRPhysicsGroundWalk(); 58 this->bContinuousPoll = true; 58 59 break; 59 60 case CREngine::CR_OBJECT_DAMAGE: … … 191 192 void CollisionHandle::handleCollisions() 192 193 { 194 // if( this->type == CREngine::CR_) 195 193 196 // collision reaction calculations (for every collision there will be a reaction) 194 197 vector<Collision*>::iterator it = this->collisionList.begin(); … … 205 208 this->bCollided = false; 206 209 210 // if continuous poll poll the reaction 211 if( this->bContinuousPoll) 212 this->collisionReaction->update(this->owner); 207 213 this->flushCollisions(); 208 214 } … … 215 221 bool CollisionHandle::filterCollisionEvent(CollisionEvent* collisionEvent) 216 222 { 223 if( this->type == CREngine::CR_PHYSICS_GROUND_WALK) 224 { 225 226 vector<long>::iterator it = this->targetList.begin(); 227 for(; it < this->targetList.end(); it++) 228 { 229 PRINTF(0)("filtering: %i vs EntityA %i, EntityB %i \n", *it, collisionEvent->getEntityA()->getClassID(), collisionEvent->getEntityB()->getClassID()); 230 231 } 232 } 233 217 234 vector<long>::iterator it = this->targetList.begin(); 218 235 for(; it < this->targetList.end(); it++) -
branches/bsp_model/src/lib/collision_reaction/collision_reaction.h
r8190 r8256 12 12 13 13 class Collision; 14 class WorldEntity; 15 14 16 15 17 //! A class representing a simple collision … … 23 25 virtual void reactToCollision(Collision* collision) = 0; 24 26 27 virtual void update(WorldEntity* owner) {} 28 29 /** use this to do some collision offline calculations, only called for bContinuousPoll == true */ 25 30 inline bool isContinuousPoll() const { return this->bContinuousPoll; } 26 31 -
branches/bsp_model/src/lib/collision_reaction/cr_engine.cc
r8234 r8256 143 143 for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++) 144 144 { 145 if( (*it)->isCollided() || (*it)->isContinuousPoll()) //does it have any collisions to report at all145 if( !(*it)->isDispatched() || (*it)->isContinuousPoll()) //does it have any collisions to report at all 146 146 { 147 PRINTF(0)("CREngine: handle %i\n", (*it)->getType());148 147 (*it)->handleCollisions(); 149 148 } -
branches/bsp_model/src/lib/collision_reaction/cr_physics_ground_walk.cc
r8234 r8256 34 34 { 35 35 this->setClassID(CL_CR_PHYSICS_GROUND_WALK, "CRPhysicsGroundWalk"); 36 37 36 } 38 37 … … 54 53 // Vector normal = collision 55 54 PRINTF(0)("Ground\n"); 55 } 56 57 58 59 /** 60 * use this to do some collision offline calculations, only called for bContinuousPoll == true 61 */ 62 void CRPhysicsGroundWalk::update(WorldEntity* owner) 63 { 64 this->lastPosition = owner->getAbsCoor(); 65 this->lastDirection = owner->getAbsDir(); 66 56 67 57 68 } 58 69 70 -
branches/bsp_model/src/lib/collision_reaction/cr_physics_ground_walk.h
r8221 r8256 21 21 virtual void reactToCollision(Collision* collision); 22 22 23 virtual void update(WorldEntity* entity); 24 23 25 private: 24 26 Vector lastPosition; //!< vector with the last valid position 25 Quaternion lastDirec iton; //!< quat with the last valid direction27 Quaternion lastDirection; //!< quat with the last valid direction 26 28 }; 27 29
Note: See TracChangeset
for help on using the changeset viewer.