What I want to know is how to use my own triangle meshes in bullet?
I have tried btBvhTriangleMeshShape to build a triangle meshes shape but it seems that calculateinertia function are not supported in version 2.74-beta.
Could Anybody tell me how to introduce user-defined triangle meshes in to simulation?
Can I use btTriangleMesh to achieve the goal? In addition, I cannot find how to use btTriangleMesh instruction in demos.
My codes are as follows:
btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray(totalTriangles,
shred_indices,
indexStride,
totalVerts,(btScalar*) &shred[0].x(),vertStride);
bool useQuantizedAabbCompression = true;
shredShape = new btBvhTriangleMeshShape(indexVertexArrays,useQuantizedAabbCompression);
m_shapes.push_back(shredShape);
btTransform starttransform;
starttransform.setIdentity();
btScalar mass(1.0f);
bool isDynamic=(mass!=0.f);
btVector3 localInertia(0,0,0);
if(isDynamic)
shredShape->calculateLocalInertia(mass,localInertia);<-------It can not work because assert(0);
float start_x=START_POS_X-SIZE_X/2;
float start_y=START_POS_Y*1.5;
float start_z=START_POS_Z-SIZE_Z/2;
starttransform.setOrigin(SCALING*btVector3(start_x*2,40+start_y,start_z));
btDefaultMotionState* mymotionstate=new btDefaultMotionState(starttransform);
btRigidBody::btRigidBodyConstructionInfo rbinfo(mass,mymotionstate,shredShape,localInertia);
btRigidBody* body=new btRigidBody(rbinfo);
body->setActivationState(ISLAND_SLEEPING);
m_dynamicsWorld->addRigidBody(body);
body->setActivationState(ISLAND_SLEEPING);
