0
\$\begingroup\$

I just started implementing some physics in my game with Bullet Physics and I was just wondering how would i use bullet physics to load in meshes. For my for DirectX I load in x files into a ID3DXMesh. I'd like to know how do I create a mesh in bullet physics instead of using boxes and spheres. I can't seem to find a way to do this. It would be great if someone could help me out. Thank you.

\$\endgroup\$
2
\$\begingroup\$

You should get the mesh's vertex positions to create a btTriangleIndexVertexArray which is required by the btBvhTriangleMeshShape's constructor. You should look into the samples (demos) provided in the Bullet library for more.
Note that Bullet meshes can only be used as static colliders (terrain for instance), not for dynamic bodies. For that you should either use Convex Hulls and/or basic shapes to create bodies that resemble your mesh to some extent. Please see ConvexDecomposition demo for that.

\$\endgroup\$
  • 1
    \$\begingroup\$ Thank you, I was going to use it for my map but I'm sure i will need meshes in the future for characters when I get more advanced but thanks for the answer. \$\endgroup\$ – MisterArch May 29 '14 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.