gjaegy wrote:I want to test wether the box shape (shown in blue) collide with the convex decomposition shape (shown in black below) + some dilatation in front of the object (shown in red).
I don't need the collision points or any information other than a boolean (collide or not).
I've never used btCollisionWorld::convexSweepTest() so far, but I think it can probably be customized (with collision masks or custom 'needsCollision' like methods) to reduce the perfomance penalty of testing against the whole world. The problem is that your shape is NOT convex, so I don't think you can't use this method with compound shapes.
You can use btCollisionWorld::contactPairTest:
Code: Select all
///contactTest performs a discrete collision test between two collision objects and calls the resultCallback if overlap if detected.
///it reports one or more contact points (including the one with deepest penetration)
void btCollisionWorld::contactPairTest(btCollisionObject* colObjA, btCollisionObject* colObjB, ContactResultCallback& resultCallback);
It should be possible to create the 'moved' btCollisionObject on the stack easily with just its btCollisionShape and a world transform (it doesn't need to be added to the world).
The problem in this case is that it will work in the case of the image you've attached, but in the general case it won't work as expected, because you need an 'enlarged' collision shape of the plane to do the test, and I don't think it's easy to create it on the fly (you could try scaling (a 'static' copy of the) the btCompoundShape and adjust its position accordingly, but I don't think that btCompoundShape::setLocalScaling(...) is reliable enough...(I usually avoid using it)).
So in short I think a good solution to your problem would be something like a btCollisionWorld::compoundShapeSweepPairTest(), but it does not exist in Bullet as far as I know
