Changeset 10006 in orxonox.OLD for branches/coll_rect/src/lib/collision_reaction/collision_tube.cc
- Timestamp:
- Dec 4, 2006, 2:24:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/coll_rect/src/lib/collision_reaction/collision_tube.cc
r9995 r10006 27 27 #include "cr_physics_full_walk.h" 28 28 29 #include "debug.h" 29 30 30 31 … … 52 53 CollisionTube::~CollisionTube () 53 54 { 55 this->reset(); 56 } 57 58 59 60 /** 61 * resets the collision tube after each collision detection cycle 62 */ 63 void CollisionTube::reset() 64 { 54 65 this->_collisionList.clear(); 66 } 67 68 69 /** 70 * gets the collision object useable for collision events registarations 71 * @param entityA collision partner 1 72 * @param entityB collision partner 2 73 * @return the collision object to be used 74 */ 75 Collision* CollisionTube::registerCollision(WorldEntity* entityA, WorldEntity* entityB) 76 { 77 assert( entityA != NULL && entityB != NULL); 78 79 Collision* collision = NULL; 80 if( !this->_collisionList.empty()) 81 collision = this->_collisionList.back(); 82 83 // check if there is already a collision defined between these objects or this is the first collision at all 84 if( collision == NULL || !collision->same(*entityA, *entityB)) 85 { 86 collision = CREngine::getInstance()->popCollisionObject(); 87 collision->collide( entityA, entityB); 88 this->_collisionList.push_back(collision); 89 } 90 91 return collision; 55 92 } 56 93 … … 67 104 void CollisionTube::registerCollisionEvent(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) 68 105 { 69 Collision* collision = NULL; 70 if( !this->_collisionList.empty()) 71 collision = this->_collisionList.back(); 72 73 // check if there is already a collision defined between these objects or this is the first collision at all 74 if( collision == NULL || !collision->match(*entityA, *entityB)) 75 { 76 collision = CREngine::getInstance()->popCollisionObject(); 77 collision->collide( entityA, entityB); 78 } 106 // first get a useable collision object 107 Collision* collision = this->registerCollision(entityA, entityB); 79 108 80 109 // now register the new collision event … … 95 124 */ 96 125 void CollisionTube::registerCollisionEvent(CREngine::CollisionType type, WorldEntity* entity, WorldEntity* groundEntity, 97 126 const Vector& normal, const Vector& position, bool bInWall) 98 127 { 99 // get last collision 100 Collision* collision = NULL; 101 if( !this->_collisionList.empty()) 102 collision = this->_collisionList.back(); 103 104 // check if there is already a collision defined between these objects 105 if( collision == NULL || !collision->match(*entity, *groundEntity)) 106 { 107 // get a new collision object 108 collision = CREngine::getInstance()->popCollisionObject(); 109 collision->collide( entity, groundEntity); 110 } 128 // first get a useable collision object 129 Collision* collision = this->registerCollision(entity, groundEntity); 111 130 112 131 // now register the new collision event
Note: See TracChangeset
for help on using the changeset viewer.