Browse Source

FBXLoader update scale and position axes only if defined on frame

Lewy Blue 7 years ago
parent
commit
6b9c6b190b
1 changed files with 34 additions and 2 deletions
  1. 34 2
      examples/js/loaders/FBXLoader.js

+ 34 - 2
examples/js/loaders/FBXLoader.js

@@ -3706,7 +3706,23 @@
 
 
 			if ( hasCurve( animationNode, 'T' ) && hasKeyOnFrame( animationNode.T, frame ) ) {
 			if ( hasCurve( animationNode, 'T' ) && hasKeyOnFrame( animationNode.T, frame ) ) {
 
 
-				key.pos = [ animationNode.T.curves.x.values[ frame ], animationNode.T.curves.y.values[ frame ], animationNode.T.curves.z.values[ frame ] ];
+				if ( animationNode.T.curves.x.values[ frame ] ) {
+
+					key.pos[ 0 ] = animationNode.T.curves.x.values[ frame ];
+
+				}
+
+				if ( animationNode.T.curves.y.values[ frame ] ) {
+
+					key.pos[ 1 ] = animationNode.T.curves.y.values[ frame ];
+
+				}
+
+				if ( animationNode.T.curves.z.values[ frame ] ) {
+
+					key.pos[ 2 ] = animationNode.T.curves.z.values[ frame ];
+
+				}
 
 
 			}
 			}
 
 
@@ -3738,7 +3754,23 @@
 
 
 			if ( hasCurve( animationNode, 'S' ) && hasKeyOnFrame( animationNode.S, frame ) ) {
 			if ( hasCurve( animationNode, 'S' ) && hasKeyOnFrame( animationNode.S, frame ) ) {
 
 
-				key.scl = [ animationNode.S.curves.x.values[ frame ], animationNode.S.curves.y.values[ frame ], animationNode.S.curves.z.values[ frame ] ];
+				if ( animationNode.T.curves.x.values[ frame ] ) {
+
+					key.scl[ 0 ] = animationNode.S.curves.x.values[ frame ];
+
+				}
+
+				if ( animationNode.T.curves.y.values[ frame ] ) {
+
+					key.scl[ 1 ] = animationNode.S.curves.y.values[ frame ];
+
+				}
+
+				if ( animationNode.T.curves.z.values[ frame ] ) {
+
+					key.scl[ 2 ] = animationNode.S.curves.z.values[ frame ];
+
+				}
 
 
 			}
 			}