Added a gCompoundChildShapePairCallback to filter (enable/disable) child shape collisions for a btCompoundShape.
Thanks to Rich McDaniel for the patch. See MyCompoundChildShapeCallback in Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp for usage.
This commit is contained in:
@@ -11,6 +11,9 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
VERSION alterations
|
||||
2013-Mar-21: Rich McDaniel - Added callback function to eliminate collisions based on shape testing
|
||||
*/
|
||||
|
||||
#include "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h"
|
||||
@@ -22,6 +25,8 @@ subject to the following restrictions:
|
||||
#include "btManifoldResult.h"
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h"
|
||||
|
||||
btShapePairCallback gCompoundChildShapePairCallback = 0;
|
||||
|
||||
btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,bool isSwapped)
|
||||
:btActivatingCollisionAlgorithm(ci,body0Wrap,body1Wrap),
|
||||
m_isSwapped(isSwapped),
|
||||
@@ -129,6 +134,12 @@ public:
|
||||
childShape->getAabb(newChildWorldTrans,aabbMin0,aabbMax0);
|
||||
m_otherObjWrap->getCollisionShape()->getAabb(m_otherObjWrap->getWorldTransform(),aabbMin1,aabbMax1);
|
||||
|
||||
if (gCompoundChildShapePairCallback)
|
||||
{
|
||||
if (!gCompoundChildShapePairCallback(m_otherObjWrap->getCollisionShape(), childShape))
|
||||
return;
|
||||
}
|
||||
|
||||
if (TestAabbAgainstAabb2(aabbMin0,aabbMax0,aabbMin1,aabbMax1))
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user