Skip to content

Commit

Permalink
UPBGE: Fix object matrix when replacing mesh.
Browse files Browse the repository at this point in the history
Previously the mesh user matrix, the matrix used in rendering,
was updated in KX_GameObject::UpdateBuckets. But only when the
scene graph node was modified. This doesn't covered a case:
if the object mesh is replaced and that the object doesn't
move.
In this case the matrix is left uninitialized as the mesh user
is recreated. To solve this issue an initialization of the
matrix is proceeded into AddMeshUser.
The other datas in RAS_MeshUser don't need this behaviour because
they are update without condition in UpdateBuckets.
  • Loading branch information
panzergame committed Aug 19, 2017
1 parent 6c8598b commit 80b3eb8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions source/gameengine/Ketsji/KX_FontObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ void KX_FontObject::AddMeshUser()
{
m_meshUser = new RAS_TextUser(m_pClient_info, m_boundingBox);

// Make sure the mesh user get the matrix even if the object doesn't move.
NodeGetWorldTransform().getValue(m_meshUser->GetMatrix());

RAS_BucketManager *bucketManager = GetScene()->GetBucketManager();
Expand Down
2 changes: 2 additions & 0 deletions source/gameengine/Ketsji/KX_GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,8 @@ void KX_GameObject::AddMeshUser()
{
for (size_t i = 0; i < m_meshes.size(); ++i) {
m_meshUser = m_meshes[i]->AddMeshUser(m_pClient_info, GetDeformer());
// Make sure the mesh user get the matrix even if the object doesn't move.
NodeGetWorldTransform().getValue(m_meshUser->GetMatrix());
}

if (m_meshUser) {
Expand Down
2 changes: 1 addition & 1 deletion source/tools
Submodule tools updated from 4ace84 to b11375

0 comments on commit 80b3eb8

Please sign in to comment.