What I want to do is to be able to get the [ordered] vertices of each face comprising a btConvexHullShape. It is my understanding that all points added to a btConvexHullshape are automatically converted into a convex shape in 3d space. Correct? So what I'd like to do is visually verify the shape created (and used as a collision shape) by the btConvexHullShape with the given vertices. I already have code which displays the faces of a triangle mesh used for a btGImpactMeshShape, but this works a bit differently because it directly retrieves each triangle face from a btTriangleIndexVertexArray. There is no such data storage structure for btConvexHullShape, it would seem. I tried grabbing each edge (convexHullShape->getEdge(int i)) and drawing it, thinking it would give me a wireframe of the convex hull, but the result is just a mess (continuous loop, actually) of lines between various unrelated vertices (it looks like each edge is just a pair of consecutive vertices in the vertex list of the shape, not actual edges in the theoretical convex hull shape).
So, essentially, I apparently have access to all the vertices that make up the convex hull, but no way to properly connect them for the purpose of display. Is it possible to do what I want to do? The reason I ask is because I *think* I have successfully employed a convex hull decomposition of meshes using btGImpactConvexDecompositionShape (from demo source files) but I really need to visually verify the convex hulls that a mesh is broken down into; ie the *actual* shapes being used for collision.
Thanks.
How to retrieve faces of a btConvexHullShape?
-
dphil
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: How to retrieve faces of a btConvexHullShape?
Bullet doesn't generate triangles or connectivity for a btConvexHullShape to perform collision detection, it just uses the vertices.
If you want to render a btConvexHullShape you can generate triangles, using the btShapeHull utility.
See Bullet/src/BulletCollision/CollisionShapes/btShapeHull.h or http://code.google.com/p/bullet/source/ ... r=1973#348
Thanks,
Erwin
If you want to render a btConvexHullShape you can generate triangles, using the btShapeHull utility.
See Bullet/src/BulletCollision/CollisionShapes/btShapeHull.h or http://code.google.com/p/bullet/source/ ... r=1973#348
Thanks,
Erwin
-
dphil
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: How to retrieve faces of a btConvexHullShape?
Thanks a lot Erwin. I am using the btShapeHull utility now and it works great. Some of the GL_ShapeDrawer code also proved to be a useful guide in drawing the hulls. Cheers.