Ver código fonte

PreRotations supported for generating models.

Kyle-Larson 8 anos atrás
pai
commit
8e027ab8f7
1 arquivos alterados com 19 adições e 1 exclusões
  1. 19 1
      examples/js/loaders/FBXLoader2.js

+ 19 - 1
examples/js/loaders/FBXLoader2.js

@@ -1210,7 +1210,7 @@
 
 					if ( 'Lcl_Rotation' in node.properties ) {
 
-						var rotation = parseFloatArray( node.properties.Lcl_Rotation.value ).map( function ( value ) {
+						var rotation = parseFloatArray( node.properties.Lcl_Rotation.value ).map( function ( value, index ) {
 
 							return value * Math.PI / 180;
 
@@ -1226,6 +1226,15 @@
 
 					}
 
+					if ( 'PreRotation' in node.properties ) {
+
+						var preRotations = parseVector3( node.properties.PreRotation ).multiplyScalar( Math.PI / 180 );
+						model.rotation.x += preRotations.x;
+						model.rotation.y += preRotations.y;
+						model.rotation.z += preRotations.z;
+
+					}
+
 					var conns = connections.get( model.FBX_ID );
 					for ( var parentIndex = 0; parentIndex < conns.parents.length; parentIndex ++ ) {
 
@@ -1366,6 +1375,15 @@
 
 					}
 
+					if ( 'PreRotation' in node.properties ) {
+
+						var preRotations = parseVector3( node.properties.PreRotation ).multiplyScalar( Math.PI / 180 );
+						model.rotation.x += preRotations.x;
+						model.rotation.y += preRotations.y;
+						model.rotation.z += preRotations.z;
+
+					}
+
 				}
 
 				// Silly hack with the animation parsing.  We're gonna pretend the scene graph has a skeleton