Skip to content

Commit

Permalink
Fix incorrect dynamic allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Sep 24, 2016
1 parent 1136795 commit f5a49ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dart/collision/bullet/BulletCollisionDetector.cpp
Expand Up @@ -491,17 +491,17 @@ btCollisionShape* BulletCollisionDetector::createBulletCollisionShape(
const auto numSpheres = multiSphere->getNumSpheres();
const auto& spheres = multiSphere->getSpheres();

btVector3 bulletPositions[numSpheres];
btScalar bulletRadii[numSpheres];
std::vector<btVector3> bulletPositions(numSpheres);
std::vector<btScalar> bulletRadii(numSpheres);

for (auto i = 0u; i < numSpheres; ++i)
{
bulletRadii[i] = static_cast<btScalar>(spheres[i].first);
bulletPositions[i] = convertVector3(spheres[i].second);
}

bulletCollisionShape
= new btMultiSphereShape(bulletPositions, bulletRadii, numSpheres);
bulletCollisionShape = new btMultiSphereShape(
bulletPositions.data(), bulletRadii.data(), numSpheres);
}
else if (shape->is<MeshShape>())
{
Expand Down

0 comments on commit f5a49ab

Please sign in to comment.