2
0
Эх сурвалжийг харах

MD2Character*: Use first frame for reference boundingBox.

Mr.doob 6 жил өмнө
parent
commit
de338cfb98

+ 4 - 2
examples/js/MD2Character.js

@@ -44,8 +44,10 @@ THREE.MD2Character = function () {
 
 
 		loader.load( config.baseUrl + config.body, function ( geo ) {
 		loader.load( config.baseUrl + config.body, function ( geo ) {
 
 
-			geo.computeBoundingBox();
-			scope.root.position.y = - scope.scale * geo.boundingBox.min.y;
+			var boundingBox = new THREE.Box3();
+			boundingBox.setFromBufferAttribute( geo.attributes.position );
+			
+			scope.root.position.y = - scope.scale * boundingBox.min.y;
 
 
 			var mesh = createPart( geo, scope.skinsBody[ 0 ] );
 			var mesh = createPart( geo, scope.skinsBody[ 0 ] );
 			mesh.scale.set( scope.scale, scope.scale, scope.scale );
 			mesh.scale.set( scope.scale, scope.scale, scope.scale );

+ 4 - 2
examples/js/MD2CharacterComplex.js

@@ -156,8 +156,10 @@ THREE.MD2CharacterComplex = function () {
 
 
 		loader.load( config.baseUrl + config.body, function( geo ) {
 		loader.load( config.baseUrl + config.body, function( geo ) {
 
 
-			geo.computeBoundingBox();
-			scope.root.position.y = - scope.scale * geo.boundingBox.min.y;
+			var boundingBox = new THREE.Box3();
+			boundingBox.setFromBufferAttribute( geo.attributes.position );
+
+			scope.root.position.y = - scope.scale * boundingBox.min.y;
 
 
 			var mesh = createPart( geo, scope.skinsBody[ 0 ] );
 			var mesh = createPart( geo, scope.skinsBody[ 0 ] );
 			mesh.scale.set( scope.scale, scope.scale, scope.scale );
 			mesh.scale.set( scope.scale, scope.scale, scope.scale );