Browse Source

Update FX

ShiroSmith 6 years ago
parent
commit
052d5d0fd1
1 changed files with 10 additions and 4 deletions
  1. 10 4
      hide/view/FXScript.hx

+ 10 - 4
hide/view/FXScript.hx

@@ -52,10 +52,16 @@ class FXScript {
 			field += names[index];
 
 		return switch(field){
-			case "rotationX": function(v){ curObj.setRotationAxis(1,0,0,v); };
-			case "rotationY": function(v){ curObj.setRotationAxis(0,1,0,v); };
-			case "rotationZ": function(v){ curObj.setRotationAxis(0,0,1,v); };
-			default: function(v){ Reflect.setProperty(curObj, field, v); };
+			case "rotationX": function(v){
+				var euler = curObj.getRotationQuat().toEuler();
+				curObj.setRotation(v, euler.y, euler.z);};
+			case "rotationY": function(v){
+				var euler = curObj.getRotationQuat().toEuler();
+				curObj.setRotation(euler.x, v, euler.z); };
+			case "rotationZ": function(v){
+				var euler = curObj.getRotationQuat().toEuler();
+				curObj.setRotation(euler.x, euler.y, v);};
+			default: function(v){ if(Reflect.hasField(curObj, field)) Reflect.setProperty(curObj, field, v); };
 		}
 	}