diff --git a/src/main/java/com/hbm/render/anim/AnimationLoader.java b/src/main/java/com/hbm/render/anim/AnimationLoader.java index 686e13965..0f99d66b3 100644 --- a/src/main/java/com/hbm/render/anim/AnimationLoader.java +++ b/src/main/java/com/hbm/render/anim/AnimationLoader.java @@ -69,7 +69,7 @@ public class AnimationLoader { if(json.has("rotmode")) { for(Map.Entry root : json.getAsJsonObject("rotmode").entrySet()) { String mode = root.getValue().getAsString(); - + double[] rotMode = new double[3]; rotMode[0] = getRot(mode.charAt(2)); rotMode[1] = getRot(mode.charAt(0)); @@ -115,45 +115,27 @@ public class AnimationLoader { if(json.has("location")) { JsonObject location = json.getAsJsonObject("location"); - if(location.has("x")) { - addToSequence(sequence, Dimension.TX, location.getAsJsonArray("x")); - } - if(location.has("y")) { - addToSequence(sequence, Dimension.TY, location.getAsJsonArray("y")); - } - if(location.has("z")) { - addToSequence(sequence, Dimension.TZ, location.getAsJsonArray("z")); - } + if(location.has("x")) addToSequence(sequence, Dimension.TX, location.getAsJsonArray("x")); + if(location.has("y")) addToSequence(sequence, Dimension.TY, location.getAsJsonArray("y")); + if(location.has("z")) addToSequence(sequence, Dimension.TZ, location.getAsJsonArray("z")); } // Rotation fcurves, only euler at the moment if(json.has("rotation_euler")) { JsonObject rotation = json.getAsJsonObject("rotation_euler"); - if(rotation.has("x")) { - addToSequence(sequence, Dimension.RX, rotation.getAsJsonArray("x")); - } - if(rotation.has("y")) { - addToSequence(sequence, Dimension.RY, rotation.getAsJsonArray("y")); - } - if(rotation.has("z")) { - addToSequence(sequence, Dimension.RZ, rotation.getAsJsonArray("z")); - } + if(rotation.has("x")) addToSequence(sequence, Dimension.RX, rotation.getAsJsonArray("x")); + if(rotation.has("y")) addToSequence(sequence, Dimension.RY, rotation.getAsJsonArray("y")); + if(rotation.has("z")) addToSequence(sequence, Dimension.RZ, rotation.getAsJsonArray("z")); } // Scale fcurves if(json.has("scale")) { JsonObject scale = json.getAsJsonObject("scale"); - if(scale.has("x")) { - addToSequence(sequence, Dimension.SX, scale.getAsJsonArray("x")); - } - if(scale.has("y")) { - addToSequence(sequence, Dimension.SY, scale.getAsJsonArray("y")); - } - if(scale.has("z")) { - addToSequence(sequence, Dimension.SZ, scale.getAsJsonArray("z")); - } + if(scale.has("x")) addToSequence(sequence, Dimension.SX, scale.getAsJsonArray("x")); + if(scale.has("y")) addToSequence(sequence, Dimension.SY, scale.getAsJsonArray("y")); + if(scale.has("z")) addToSequence(sequence, Dimension.SZ, scale.getAsJsonArray("z")); } sequence.offset = offset; diff --git a/src/main/java/com/hbm/render/anim/BusAnimationKeyframe.java b/src/main/java/com/hbm/render/anim/BusAnimationKeyframe.java index ce55f00e5..e25f5f95e 100644 --- a/src/main/java/com/hbm/render/anim/BusAnimationKeyframe.java +++ b/src/main/java/com/hbm/render/anim/BusAnimationKeyframe.java @@ -236,12 +236,12 @@ public class BusAnimationKeyframe { // Blender bezier solvers, but rewritten (pain) private double solveCubic(double c0, double c1, double c2, double c3) { - if(c3 > 0.000001) { + if(c3 > 0.000001 || c3 < -0.000001) { double a = c2 / c3; double b = c1 / c3; double c = c0 / c3; a = a / 3; - + double p = b / 3 - a * a; double q = (2 * a * a * a - a * b + c) / 2; double d = q * q + p * p * p;