Hi, i wanto to use a triangle mesh made in blender in my bullet application, how do i must to do? i seached some tutorial but i can't find any page that explains how to set up a triangle mesh in my bullet world as a box shape or a sphere shape, so no static but dynamic object.
I read that dynamic objects made as triangle meshes are controlled by GImpact but in its site i can't find any information, it redirect to Bullet forum for more detail or information so i'm here XD
triangle mesh with GImpact HOWTO
-
- Posts: 10
- Joined: Thu Jul 04, 2013 8:13 am
Re: triangle mesh with GImpact HOWTO
Luckily, I'm working with GImpact. However I don't use dynamics and maybe it will lacks some wiring.
How to wire a collision object :
How to wire a collision world :
How to wire a collision object :
Code: Select all
btIndexedMesh indexedMesh = {
... // Fill this structure with the object mesh data
};
btTriangleIndexVertexArray* indexedMeshes = new btTriangleIndexVertexArray();
indexedMeshes->addIndexedMesh(
indexedMesh
);
btGImpactConvexDecompositionShape* shape = new btGImpactConvexDecompositionShape(
indexedMeshes, btVector3( 1.0, 1.0, 1.0 ) // Adjust this scale value
);
shape->setMargin( 0.0 ); // Adjust this margin value
shape->updateBound();
btCollisionObject* collisionObject = new btCollisionObject();
collisionObject ->setCollisionShape( shape );
Code: Select all
btDefaultCollisionConfiguration* configuration = new btDefaultCollisionConfiguration();
btCollisionDispatcher* dispatcher = new btCollisionDispatcher( configuration );
btGImpactCollisionAlgorithm::registerAlgorithm( dispatcher );
btCollisionWorld* collisionWorld = new btCollisionWorld(
dispatcher,
new btDbvtBroadphase(),
configuration
);
collisionWorld->addCollisionObject( ... );
collisionWorld->addCollisionObject( ... );
collisionWorld->addCollisionObject( ... );
...