Browse Source

Merge pull request #14855 from panxinmiao/dev

Fixed some bugs in MMD classes
Mr.doob 6 năm trước cách đây
mục cha
commit
433434e39a

+ 3 - 0
examples/js/animation/MMDAnimationHelper.js

@@ -945,6 +945,9 @@ THREE.MMDAnimationHelper = ( function () {
 			}
 
 			if ( this.currentTime < this.delayTime ) return false;
+			
+			// 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration
+			if ( ( this.currentTime - this.delayTime ) > this.audioDuration ) return false;
 
 			this.audio.startTime = this.currentTime - this.delayTime;
 

+ 2 - 2
examples/js/animation/MMDPhysics.js

@@ -47,7 +47,7 @@ THREE.MMDPhysics = ( function () {
 		this.maxStepNum = ( params.maxStepNum !== undefined ) ? params.maxStepNum : 3;
 		this.gravity = new THREE.Vector3( 0, - 9.8 * 10, 0 );
 
-		if ( params.gravity !== undefined ) this.gravity.copy( gravity );
+		if ( params.gravity !== undefined ) this.gravity.copy( params.gravity );
 
 		this.world = params.world !== undefined ? params.world : null; // experimental
 
@@ -116,7 +116,7 @@ THREE.MMDPhysics = ( function () {
 
 			if ( isNonDefaultScale ) {
 
-				if ( parent !== null ) parent.parent = parent;
+				if ( parent !== null ) mesh.parent = parent;
 
 				mesh.scale.copy( scale );