applied patch to make child shape of a compound shape available during ray testing.
Thanks to Benoit Bolsee for the patch: http://code.google.com/p/bullet/issues/detail?id=91
This commit is contained in:
@@ -384,12 +384,16 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
|
||||
btTransform childTrans = compoundShape->getChildTransform(i);
|
||||
const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
|
||||
btTransform childWorldTrans = colObjWorldTransform * childTrans;
|
||||
// replace collision shape so that callback can determine the triangle
|
||||
btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
|
||||
collisionObject->internalSetTemporaryCollisionShape((btCollisionShape*)childCollisionShape);
|
||||
rayTestSingle(rayFromTrans,rayToTrans,
|
||||
collisionObject,
|
||||
childCollisionShape,
|
||||
childWorldTrans,
|
||||
resultCallback);
|
||||
|
||||
// restore
|
||||
collisionObject->internalSetTemporaryCollisionShape(saveCollisionShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -576,11 +580,16 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
|
||||
btTransform childTrans = compoundShape->getChildTransform(i);
|
||||
const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
|
||||
btTransform childWorldTrans = colObjWorldTransform * childTrans;
|
||||
// replace collision shape so that callback can determine the triangle
|
||||
btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
|
||||
collisionObject->internalSetTemporaryCollisionShape((btCollisionShape*)childCollisionShape);
|
||||
objectQuerySingle(castShape, convexFromTrans,convexToTrans,
|
||||
collisionObject,
|
||||
childCollisionShape,
|
||||
childWorldTrans,
|
||||
resultCallback, allowedPenetration);
|
||||
// restore
|
||||
collisionObject->internalSetTemporaryCollisionShape(saveCollisionShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user