should i be using btTriangleMesh to match a collision object with my model?
if so then how would i go on about doing this?
-Molma
EDIT: I attempted some code just now, but as of now, the game crashes instantly.
this is the code that i came up with, while looking at other peoples codes:
Code: Select all
btRigidBody *GroundBodyCreate()
{
btTriangleMesh *WorldTriMesh = new btTriangleMesh();
for(int v=0;v<ModelList[0]->numvertices;v+3)
{
btVector3 v0(ModelList[0]->vertices[v,0],ModelList[0]->vertices[v,1],ModelList[0]->vertices[v,2]);
btVector3 v1(ModelList[0]->vertices[v+1,0],ModelList[0]->vertices[v+1,1],ModelList[0]->vertices[v+1,2]);
btVector3 v2(ModelList[0]->vertices[v+2,0],ModelList[0]->vertices[v+2,1],ModelList[0]->vertices[v+2,2]);
WorldTriMesh->addTriangle(v0,v1,v2);
}
btCollisionShape *WorldColShape = new btBvhTriangleMeshShape(WorldTriMesh,false);
btDefaultMotionState *defMOTstate = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,-1,0)));
btRigidBody::btRigidBodyConstructionInfo GroundBodyCI(0,defMOTstate,WorldColShape,btVector3(0,0,0));
btRigidBody *GroundBody = new btRigidBody(GroundBodyCI);
return GroundBody;
}