Skip to content

Commit

Permalink
UPBGE: Fix physics shape reinstancing.
Browse files Browse the repository at this point in the history
Previously the vertex remap was resized with default value to -1 but if
this list wasn't empty the previous value were kept. To initialize all
values to -1 std::fill is used.

Fix issue: #622.
  • Loading branch information
panzergame committed Oct 26, 2017
1 parent 60e3250 commit f1cef71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,9 @@ bool CcdShapeConstructionInfo::UpdateMesh(KX_GameObject *gameobj, RAS_MeshObject
}

m_vertexArray.resize(numVertices * 3);
m_vertexRemap.resize(numVertices, -1);
m_vertexRemap.resize(numVertices);
// resize() doesn't initialize all values if the vector wasn't empty before. Prefer fill explicitly.
std::fill(m_vertexRemap.begin(), m_vertexRemap.end(), -1);

// Current vertex written.
unsigned int curVert = 0;
Expand Down

0 comments on commit f1cef71

Please sign in to comment.