diff --git a/Source/Engine/Tools/ModelTool/ModelTool.cpp b/Source/Engine/Tools/ModelTool/ModelTool.cpp index 1257d49cc..e2b2f5d8d 100644 --- a/Source/Engine/Tools/ModelTool/ModelTool.cpp +++ b/Source/Engine/Tools/ModelTool/ModelTool.cpp @@ -1219,13 +1219,13 @@ bool ModelTool::ImportModel(const String& path, ModelData& data, Options& option // Apply the import transformation if (!importTransform.IsIdentity()) { - // Transform the root node using the import transformation - auto& root = data.Skeleton.RootNode(); - Transform meshTransform = root.LocalTransform.WorldToLocal(importTransform).LocalToWorld(root.LocalTransform); - root.LocalTransform = importTransform.LocalToWorld(root.LocalTransform); - if (options.Type == ModelType::SkinnedModel) { + // Transform the root node using the import transformation + auto& root = data.Skeleton.RootNode(); + Transform meshTransform = root.LocalTransform.WorldToLocal(importTransform).LocalToWorld(root.LocalTransform); + root.LocalTransform = importTransform.LocalToWorld(root.LocalTransform); + // Apply import transform on meshes Matrix meshTransformMatrix; meshTransform.GetWorld(meshTransformMatrix); @@ -1249,6 +1249,12 @@ bool ModelTool::ImportModel(const String& path, ModelData& data, Options& option bone.OffsetMatrix = importMatrixInv * bone.OffsetMatrix; } } + else + { + // Transform the root node using the import transformation + auto& root = data.Nodes[0]; + root.LocalTransform = importTransform.LocalToWorld(root.LocalTransform); + } } // Post-process imported data