Changeset 8284 for code/branches/kicklib2/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
- Timestamp:
- Apr 21, 2011, 6:58:23 PM (14 years ago)
- Location:
- code/branches/kicklib2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib2
- Property svn:mergeinfo changed
-
code/branches/kicklib2/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
r5781 r8284 115 115 void ProcessChildShape(btCollisionShape* childShape,int index) 116 116 { 117 117 btAssert(index>=0); 118 118 btCompoundShape* compoundShape = static_cast<btCompoundShape*>(m_compoundColObj->getCollisionShape()); 119 btAssert(index<compoundShape->getNumChildShapes()); 119 120 120 121 … … 142 143 if (!m_childCollisionAlgorithms[index]) 143 144 m_childCollisionAlgorithms[index] = m_dispatcher->findAlgorithm(m_compoundColObj,m_otherObj,m_sharedManifold); 145 146 ///detect swapping case 147 if (m_resultOut->getBody0Internal() == m_compoundColObj) 148 { 149 m_resultOut->setShapeIdentifiersA(-1,index); 150 } else 151 { 152 m_resultOut->setShapeIdentifiersB(-1,index); 153 } 144 154 145 155 m_childCollisionAlgorithms[index]->processCollision(m_compoundColObj,m_otherObj,m_dispatchInfo,m_resultOut); … … 258 268 int i; 259 269 btManifoldArray manifoldArray; 260 270 btCollisionShape* childShape = 0; 271 btTransform orgTrans; 272 btTransform orgInterpolationTrans; 273 btTransform newChildWorldTrans; 274 btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1; 275 261 276 for (i=0;i<numChildren;i++) 262 277 { 263 278 if (m_childCollisionAlgorithms[i]) 264 279 { 265 btCollisionShape*childShape = compoundShape->getChildShape(i);280 childShape = compoundShape->getChildShape(i); 266 281 //if not longer overlapping, remove the algorithm 267 btTransformorgTrans = colObj->getWorldTransform();268 btTransformorgInterpolationTrans = colObj->getInterpolationWorldTransform();282 orgTrans = colObj->getWorldTransform(); 283 orgInterpolationTrans = colObj->getInterpolationWorldTransform(); 269 284 const btTransform& childTrans = compoundShape->getChildTransform(i); 270 btTransformnewChildWorldTrans = orgTrans*childTrans ;285 newChildWorldTrans = orgTrans*childTrans ; 271 286 272 287 //perform an AABB check first 273 btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1;274 288 childShape->getAabb(newChildWorldTrans,aabbMin0,aabbMax0); 275 289 otherObj->getCollisionShape()->getAabb(otherObj->getWorldTransform(),aabbMin1,aabbMax1); … … 281 295 m_childCollisionAlgorithms[i] = 0; 282 296 } 283 284 297 } 285 286 } 287 288 289 298 } 290 299 } 291 300 } … … 312 321 int numChildren = m_childCollisionAlgorithms.size(); 313 322 int i; 323 btTransform orgTrans; 324 btScalar frac; 314 325 for (i=0;i<numChildren;i++) 315 326 { … … 318 329 319 330 //backup 320 btTransformorgTrans = colObj->getWorldTransform();331 orgTrans = colObj->getWorldTransform(); 321 332 322 333 const btTransform& childTrans = compoundShape->getChildTransform(i); … … 326 337 btCollisionShape* tmpShape = colObj->getCollisionShape(); 327 338 colObj->internalSetTemporaryCollisionShape( childShape ); 328 btScalarfrac = m_childCollisionAlgorithms[i]->calculateTimeOfImpact(colObj,otherObj,dispatchInfo,resultOut);339 frac = m_childCollisionAlgorithms[i]->calculateTimeOfImpact(colObj,otherObj,dispatchInfo,resultOut); 329 340 if (frac<hitFraction) 330 341 {
Note: See TracChangeset
for help on using the changeset viewer.