diff --git a/Prowl.Runtime/AssetImporting/ModelImporter.cs b/Prowl.Runtime/AssetImporting/ModelImporter.cs index cbf61eab..db06446c 100644 --- a/Prowl.Runtime/AssetImporting/ModelImporter.cs +++ b/Prowl.Runtime/AssetImporting/ModelImporter.cs @@ -431,9 +431,27 @@ private static void LoadAnimations(Assimp.Scene? scene, double scale, List 30 seconds for typical animations) + double rawDuration = anim.DurationInTicks / ticksPerSecond; + if (ticksPerSecond < 100 && rawDuration > 30.0) + { + // This is likely a glTF file with the bug - force TicksPerSecond to 1000 + Debug.LogWarning($"Animation '{anim.Name}' appears to be glTF with incorrect TicksPerSecond. " + + $"Original TPS: {ticksPerSecond}, Duration: {rawDuration:F2}s. " + + $"Correcting to TPS=1000 for glTF..."); + ticksPerSecond = 1000.0; + } + + animation.TicksPerSecond = ticksPerSecond; animation.DurationInTicks = anim.DurationInTicks; + animation.Duration = anim.DurationInTicks / ticksPerSecond; foreach (var channel in anim.NodeAnimationChannels) { diff --git a/Prowl.Runtime/Components/ModelRenderer.cs b/Prowl.Runtime/Components/ModelRenderer.cs index 86d2992b..dcdf85ca 100644 --- a/Prowl.Runtime/Components/ModelRenderer.cs +++ b/Prowl.Runtime/Components/ModelRenderer.cs @@ -19,7 +19,7 @@ public class ModelRenderer : MonoBehaviour public AnimationClip CurrentAnimation; public bool PlayAutomatically = true; public bool Loop = true; - public double AnimationSpeed = 10.0; + public double AnimationSpeed = 1.0; private double _animationTime = 0.0; private bool _isPlaying = false; @@ -56,7 +56,7 @@ public override void Update() // Update animation if (_isPlaying && CurrentAnimation != null) { - _animationTime += Time.deltaTimeF * AnimationSpeed; + _animationTime += Time.deltaTime * AnimationSpeed; if (_animationTime >= CurrentAnimation.Duration) {