From dff51d0a8a5507391d930641735480e4eff57fb5 Mon Sep 17 00:00:00 2001 From: Dieter De Paepe Date: Sun, 12 Jul 2026 17:29:29 +0200 Subject: [PATCH] Fix wrong interpolation ratio in glTF TrackData.populateTransform() When a node's translation/rotation/scale channels carry different keyframe timestamps, update() merges them onto one shared time grid and gap-fills missing samples via populateTransform()/interpolate(). The blend ratio for that interpolation was computed as "currentKeyFrame.time / (nextKeyFrame.time - lastKeyFrame.time)", missing "- lastKeyFrame.time" in the numerator. Instead of the intended 0..1 blend position within [lastKeyFrame.time, nextKeyFrame.time], this passed the clip's absolute elapsed time into Quaternion.nlerp(), which doesn't clamp its blend parameter and so extrapolated wildly rather than interpolating. --- .../src/gltf/java/com/jme3/scene/plugins/gltf/TrackData.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/TrackData.java b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/TrackData.java index c453e5f7aa..eabd234f1c 100644 --- a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/TrackData.java +++ b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/TrackData.java @@ -221,7 +221,8 @@ private void populateTransform(Type type, int index, List keyFrames, K } else { //interpolation between the previous transform and the next one. KeyFrame lastKeyFrame = keyFrames.get(transformIndices.last); - float ratio = currentKeyFrame.time / (nextKeyFrame.time - lastKeyFrame.time); + float ratio = (currentKeyFrame.time - lastKeyFrame.time) + / (nextKeyFrame.time - lastKeyFrame.time); interpolate(type, ratio, lastKeyFrame, nextKeyFrame, index); }