[SOLVED] mesh to convex hull shape

nord666

05-09-2008 13:13:31

Hello,

I want to know how to make a convex hull shape from a mesh.
Can someone help me?

Thanks

imajia

10-09-2008 20:20:41

Creating the btConvexHullShape or the OgreBullet wrapper can be done like this

1. retrieve the vertex data from the mesh
2. add the vertices to the convex hull


1. retrieve the vertex data from the mesh
  1. In the class OgreBulletCollisionsMeshToShapeConverter.cpp are some helper function which parse a mesh and store the vertex data for later usage.[/*:m]
  2. http://www.ogre3d.org/wiki/index.php/RetrieveVertexData
    Has another example of how to load the vertex data from a mesh[/*:m][/list:u]
    Remark:It works, but when you use the meshes from the Ogre SDK, you might get some problems. For example "cube.mesh" has an unused vertex with the coordinates (0,0,0) at position 0 in the vertex list. So to be sure that you only pass vertices which are used, you have to validate the indices. In case the mesh only includes used vertices, you can skip this step.


    2. add the vertices to the convex hull
    This can be done with the class OgreBulletCollisionsConvexHullShape. It doesn't provide all features from the class btConvexHullShape, so you might have to add a few methods like addPoint if you need it.

nord666

16-09-2008 14:26:51

Thank you :!:

nikki

19-09-2008 19:52:22

Don't forget to check out the converters included in OgreBullet too!

CHG123

07-12-2008 21:54:49

if I use a convex hull shape and set it to be kinematic will I be able to have an animated mesh respond to collisions?

How are animation generally handled in a physics world? or if you are using physics you just don't use animations and split the body into separate meshes with joints inbetween and move them based on force etc... instead of animations?