Skip to content

Commit

Permalink
Simplify shape_id counter
Browse files Browse the repository at this point in the history
  • Loading branch information
rjoomen committed Dec 18, 2024
1 parent 1b035c7 commit 73496d2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tesseract_collision/bullet/src/bullet_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,16 +467,14 @@ CollisionObjectWrapper::CollisionObjectWrapper(std::string name,
// effect when negative
setCollisionShape(compound.get());

int shape_id{ 0 };
for (std::size_t j = 0; j < m_shapes.size(); ++j)
{
if (m_shapes[j]->getType() == tesseract_geometry::GeometryType::COMPOUND_MESH)
{
int shape_index = shape_id++;
const auto& meshes = std::static_pointer_cast<const tesseract_geometry::CompoundMesh>(m_shapes[j])->getMeshes();
for (const auto& mesh : meshes)
{
std::shared_ptr<btCollisionShape> subshape = createShapePrimitive(mesh, this, shape_index);
std::shared_ptr<btCollisionShape> subshape = createShapePrimitive(mesh, this, static_cast<int>(j));
if (subshape != nullptr)
{
manage(subshape);
Expand All @@ -487,7 +485,7 @@ CollisionObjectWrapper::CollisionObjectWrapper(std::string name,
}
else
{
std::shared_ptr<btCollisionShape> subshape = createShapePrimitive(m_shapes[j], this, shape_id++);
std::shared_ptr<btCollisionShape> subshape = createShapePrimitive(m_shapes[j], this, static_cast<int>(j));
if (subshape != nullptr)
{
manage(subshape);
Expand Down

0 comments on commit 73496d2

Please sign in to comment.