I have created a btConvexHullShape using a .obj file. I have checked its other properties and it seems created properly.
Now I have to perform a collision detection check. for that I need to use the isInside function. But its returning False whether the point is inside or outside.
Can any one help?
human = new btConvexHullShape();
for (int i = 0; i < av->vertI; i++)
{
human->addPoint(btVector3(btScalar(av->vertices[i][0]), btScalar(av->vertices[i][1]), btScalar(av->vertices[i][2])));
}
CString s;
btVector3 cx(0, -2, 1);
if (human->isInside(cx, btScalar(1)))
{
OutputDebugString(L"True\n");
}
else
OutputDebugString(L"False\n");
I reproduced the same issue using BulletSharp in C#. Here is my code:
checkInside is false, whereas the point {50,50,50} is inside the convex hull. I looked up the BtConvexHullShape class implemententation. It seems that the IsInside function is not implemented yet and always returns false.
I did some googling on my own and found an IsInside() implementation for triangular mesh objects. The proposed solution uses ray-casting. I haven't tested the code yet, but it looks promising.