I am trying to do a sweep test with convex shapes (a capsule). I thought I could reuse a class I found in the CharacterDemo project file “DynamicCharacterController.cpp” called ClosestNotMe. I have tried to rewrite this class so it accommodates for convex shapes but I have not been successful. I found that there are structures that correspond to each other called LocalRayResult/LocalConvexResult. I guess I should be using the latter somehow.
This is what I got so far:
Code: Select all
class ClosestNotMeSweep : public btCollisionWorld::ClosestConvexResultCallback
{
public:
ClosestNotMeSweep (btRigidBody* me) : btCollisionWorld::ClosestConvexResultCallback(btVector3(0.0, 0.0, 0.0), btVector3(0.0, 0.0, 0.0))
{
m_me = me;
}
virtual btScalar addSingleResult(btCollisionWorld::LocalConvexResult& convexResult,bool normalInWorldSpace)
{
if (convexResult.m_hitCollisionObject == m_me)
return 1.0;
return ClosestConvexResultCallback::addSingleResult (convexResult, normalInWorldSpace
);
}
protected:
btRigidBody* m_me;
};
Any guidance appreciated. Thanks for reading!