From dc16655d3503dbadcf4fc67a37b39faff54d2bb7 Mon Sep 17 00:00:00 2001 From: erwin coumans Date: Thu, 28 Aug 2014 19:01:56 -0700 Subject: [PATCH] more bug fixes --- Demos3/ImportURDFDemo/ImportURDFSetup.cpp | 9 ++++++++- src/Bullet3Common/b3FileUtils.h | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Demos3/ImportURDFDemo/ImportURDFSetup.cpp b/Demos3/ImportURDFDemo/ImportURDFSetup.cpp index 6d42aca7b..e737d3e60 100644 --- a/Demos3/ImportURDFDemo/ImportURDFSetup.cpp +++ b/Demos3/ImportURDFDemo/ImportURDFSetup.cpp @@ -177,7 +177,14 @@ btCollisionShape* convertVisualToCollisionShape(const Visual* visual, const char printf("extracted %d verticed from STL file %s\n", glmesh->m_numvertices,fullPath); //int shapeId = m_glApp->m_instancingRenderer->registerShape(&gvertices[0].pos[0],gvertices.size(),&indices[0],indices.size()); //convex->setUserIndex(shapeId); - btConvexHullShape* cylZShape = new btConvexHullShape(&glmesh->m_vertices->at(0).xyzw[0], glmesh->m_numvertices, sizeof(GLInstanceVertex)); + btAlignedObjectArray convertedVerts; + convertedVerts.reserve(glmesh->m_numvertices); + for (int i=0;im_numvertices;i++) + { + convertedVerts.push_back(btVector3(glmesh->m_vertices->at(i).xyzw[0],glmesh->m_vertices->at(i).xyzw[1],glmesh->m_vertices->at(i).xyzw[2])); + } + //btConvexHullShape* cylZShape = new btConvexHullShape(&glmesh->m_vertices->at(0).xyzw[0], glmesh->m_numvertices, sizeof(GLInstanceVertex)); + btConvexHullShape* cylZShape = new btConvexHullShape(&convertedVerts[0].getX(), convertedVerts.size(), sizeof(btVector3)); //cylZShape->initializePolyhedralFeatures(); //btVector3 halfExtents(cyl->radius,cyl->radius,cyl->length/2.); //btCylinderShapeZ* cylZShape = new btCylinderShapeZ(halfExtents); diff --git a/src/Bullet3Common/b3FileUtils.h b/src/Bullet3Common/b3FileUtils.h index ea5cafa9c..dea2f4bd3 100644 --- a/src/Bullet3Common/b3FileUtils.h +++ b/src/Bullet3Common/b3FileUtils.h @@ -80,9 +80,9 @@ struct b3FileUtils } else { #ifdef _WIN32 - sprintf_s(path, maxPathLength,""); + sprintf_s(path, maxPathLength,""); #else - sprintf(path, maxPathLength,""); + sprintf(path, ""); #endif } }