I'm having a hard time figuring out which collision shapes to utilize in my game prototype. I have created a 3dsmax export script which collects all vertices from an object and exports them.
Now i want to create a collision shape using these vertices. I was under the impression the btConvexHullShape was capable of this. But when i tested it out using a few simple test values i get a weird output. Here is my test code:
Code: Select all
btScalar v[] =
{
-10.0f,0,10.0f,
10.0f, 0, 10.0f,
10.0f, 0, -10.0f,
-10.0f, 0, -10.0f
};
btConvexHullShape* shape = new btConvexHullShape(v, 4);
btDefaultMotionState* motionState = new btDefaultMotionState();
btRigidBody::btRigidBodyConstructionInfo cInfo(0, motionState, shape);
btRigidBody* body = new btRigidBody(cInfo);
m_world->addRigidBody(body);
Here is a screeshot of the convex hull using debug drawing. Note: the cube is located at 0,20,0 and i would expect a plane to be present underneath the cube in the origin.