Changeset 8125 in orxonox.OLD for branches/cr/src/lib/collision_reaction
- Timestamp:
- Jun 3, 2006, 2:53:37 PM (18 years ago)
- Location:
- branches/cr/src/lib/collision_reaction
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cr/src/lib/collision_reaction/collision_handle.cc
r8124 r8125 108 108 /** 109 109 * register a Collision to the Collision handle. 110 * @param collision 110 * @param collision the collision object to register 111 * 111 112 * This is used for internal collision registration: sharing the collision objects between Collision Reactions 112 113 * Therefore dispatching it only once … … 114 115 void CollisionHandle::registerSharedCollision(Collision* collision) 115 116 { 117 // fist check if we are listening for this Collision 118 if( !this->filterCollision(collision)) 119 return; 120 116 121 // set the state to not dispatched 117 122 this->bDispatched = false; … … 178 183 vector<long>::iterator it = this->targetList.begin(); 179 184 for(; it < this->targetList.end(); it++) 180 if( collisionEvent->getEntityA()->isA((ClassID)(*it))) 181 return true; 185 { 186 if( collisionEvent->getEntityA() == this->owner) { 187 if( collisionEvent->getEntityA()->isA((ClassID)(*it))) 188 return true; } 189 else { 190 if( collisionEvent->getEntityB()->isA((ClassID)(*it))) 191 return true; } 192 } 182 193 183 194 return false; … … 185 196 186 197 187 188 189 190 191 192 198 /** 199 * filter Collisions that are not wanted to be reacted to 200 * @param collision the collision object to filter 201 */ 202 bool CollisionHandle::filterCollision(Collision* collision) 203 { 204 vector<long>::iterator it = this->targetList.begin(); 205 for(; it < this->targetList.end(); it++) 206 { 207 if( collision->getEntityA() == this->owner) { 208 if( collision->getEntityA()->isA((ClassID)(*it))) 209 return true; } 210 else { 211 if( collision->getEntityB()->isA((ClassID)(*it))) 212 return true; } 213 } 214 215 return false; 216 } 217 218 219 220 221 222 223 -
branches/cr/src/lib/collision_reaction/collision_handle.h
r8109 r8125 47 47 void flushCollisions(); 48 48 bool filterCollisionEvent(CollisionEvent* collisionEvent); 49 bool filterCollision(Collision* collision); 50 49 51 50 52
Note: See TracChangeset
for help on using the changeset viewer.