diff options
Diffstat (limited to 'examples/ExampleBrowser/CollisionShape2TriangleMesh.cpp')
-rw-r--r-- | examples/ExampleBrowser/CollisionShape2TriangleMesh.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/examples/ExampleBrowser/CollisionShape2TriangleMesh.cpp b/examples/ExampleBrowser/CollisionShape2TriangleMesh.cpp index cfc22e05d..6443df29d 100644 --- a/examples/ExampleBrowser/CollisionShape2TriangleMesh.cpp +++ b/examples/ExampleBrowser/CollisionShape2TriangleMesh.cpp @@ -132,14 +132,13 @@ void CollisionShape2TriangleMesh(btCollisionShape* collisionShape, const btTrans { btConvexShape* convex = (btConvexShape*)collisionShape; { - const btConvexPolyhedron* pol = 0; if (convex->isPolyhedral()) { btPolyhedralConvexShape* poly = (btPolyhedralConvexShape*)convex; pol = poly->getConvexPolyhedron(); } - + if (pol) { for (int v = 0; v < pol->m_vertices.size(); v++) @@ -151,19 +150,16 @@ void CollisionShape2TriangleMesh(btCollisionShape* collisionShape, const btTrans } for (int f = 0; f < pol->m_faces.size(); f++) { - for (int ii = 2; ii < pol->m_faces[f].m_indices.size(); ii++) { indicesOut.push_back(pol->m_faces[f].m_indices[0]); - indicesOut.push_back(pol->m_faces[f].m_indices[ii-1]); + indicesOut.push_back(pol->m_faces[f].m_indices[ii - 1]); indicesOut.push_back(pol->m_faces[f].m_indices[ii]); } } - - } + } else { - btShapeHull* hull = new btShapeHull(convex); hull->buildHull(0.0, 1); |