From 863ae0393f9f4370182c5499129411c08a215939 Mon Sep 17 00:00:00 2001 From: "Sergio R. Z. Masson" <97050577+SergioRZMasson@users.noreply.github.com> Date: Fri, 22 Sep 2023 18:58:25 -0300 Subject: [PATCH] Fixed issue with morph targets and animation groups. (#1105) --- SharedProjects/Babylon2GLTF/GLTFExporter.Animation.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SharedProjects/Babylon2GLTF/GLTFExporter.Animation.cs b/SharedProjects/Babylon2GLTF/GLTFExporter.Animation.cs index b1f09abb..49a544ca 100644 --- a/SharedProjects/Babylon2GLTF/GLTFExporter.Animation.cs +++ b/SharedProjects/Babylon2GLTF/GLTFExporter.Animation.cs @@ -109,7 +109,8 @@ private void ExportAnimationGroups(GLTF gltf, BabylonScene babylonScene) else { // if the node isn't found in the scene id map, check if it is the id for a morph target - BabylonMorphTargetManager morphTargetManager = babylonScene.morphTargetManagers.FirstOrDefault(mtm => mtm.targets.Any(target => target.animations != null && target.animations.Length > 0 && target.animations[0] != null)); + BabylonMorphTargetManager morphTargetManager = babylonScene.morphTargetManagers.FirstOrDefault(mtm => mtm.targets.Any(target => target.animations != null && target.animations.Length > 0 && target.animations[0] != null && target.id == id)); + if (morphTargetManager != null) { BabylonMesh mesh = morphTargetManager.sourceMesh;