You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tracked this down to the TrackData.update() method. For the "character.gltf" model's "stand" animation, the track for node 4 ("all") has 3 translation keyframes prior to TrackData.update() but only 1 keyframe after the invocation.
timeArrays.get(0) is rotation data, for which there is a single keyframe at t=0. timeArrays.get(1) is translation data, for which there are 3 keyframes: at t=0, t=2.25, and t=4.25.
Those last 2 keyframes never get merged into the keyFrames list, so translation data is lost.
The text was updated successfully, but these errors were encountered:
stephengold
added
the
bug
Something that is supposed to work, but doesn't. More severe than a "defect".
label
May 8, 2022
"TrackData.java" implements a merge sort using spaghetti code with poor encapsulation. But in case nobody feels like rewriting it from scratch, here is a straightforward patch that I believe will solve this issue:
--- 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@@ -90,7 +90,14 @@
KeyFrame kf = keyFrames.get(j);
if (Float.floatToIntBits(kf.time) != Float.floatToIntBits(time)) {
if (time > kf.time) {
- continue;+ if (j < keyFrames.size() - 1) {+ // Keep searching for the insertion point.+ continue;+ }+ kf = new KeyFrame();+ kf.time = time;+ // Add kf after the last keyframe in the list.+ keyFrames.add(kf);
} else {
kf = new KeyFrame();
kf.time = time;
Forum thread: https://hub.jmonkeyengine.org/t/incomplete-animation/45558
I've tracked this down to the
TrackData.update()
method. For the "character.gltf" model's "stand" animation, the track for node 4 ("all") has 3 translation keyframes prior toTrackData.update()
but only 1 keyframe after the invocation.timeArrays.get(0)
is rotation data, for which there is a single keyframe at t=0.timeArrays.get(1)
is translation data, for which there are 3 keyframes: at t=0, t=2.25, and t=4.25.Those last 2 keyframes never get merged into the
keyFrames
list, so translation data is lost.The text was updated successfully, but these errors were encountered: