Explorar o código

Bugfix: fixed an issue that was recently introduced with not negating Y-rotation values when Y axis was up.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10946 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
Kae..pl %!s(int64=11) %!d(string=hai) anos
pai
achega
a499e972ab

+ 11 - 6
engine/src/blender/com/jme3/scene/plugins/blender/animations/Ipo.java

@@ -168,6 +168,9 @@ public class Ipo {
                             translation[0] = (float) value;
                             break;
                         case AC_LOC_Y:
+                            if(fixUpAxis && value != 0) {
+                                value = -value;
+                            }
                             translation[yIndex] = (float) value;
                             break;
                         case AC_LOC_Z:
@@ -179,11 +182,10 @@ public class Ipo {
                             objectRotation[0] = (float) value * degreeToRadiansFactor;
                             break;
                         case OB_ROT_Y:
-                            if (fixUpAxis) {
-                                objectRotation[yIndex] = value == 0.0f ? 0 : (float) -value * degreeToRadiansFactor;
-                            } else {
-                                objectRotation[yIndex] = (float) value * degreeToRadiansFactor;
+                            if(fixUpAxis && value != 0) {
+                                value = -value;
                             }
+                            objectRotation[yIndex] = (float) value * degreeToRadiansFactor;
                             break;
                         case OB_ROT_Z:
                             objectRotation[zIndex] = (float) value * degreeToRadiansFactor;
@@ -208,10 +210,13 @@ public class Ipo {
                             quaternionRotation[0] = (float) value;
                             break;
                         case AC_QUAT_Y:
-                            quaternionRotation[fixUpAxis ? 1 : 2] = (float) value;
+                            if(fixUpAxis && value != 0) {
+                                value = -value;
+                            }
+                            quaternionRotation[yIndex] = (float)value;
                             break;
                         case AC_QUAT_Z:
-                            quaternionRotation[fixUpAxis ? 2 : 1] = (float) value;
+                            quaternionRotation[zIndex] = (float) value;
                             break;
                         default:
                             LOGGER.log(Level.WARNING, "Unknown ipo curve type: {0}.", bezierCurves[j].getType());