소스 검색

Merge pull request #14855 from panxinmiao/dev

Fixed some bugs in MMD classes
Mr.doob 6 년 전
부모
커밋
433434e39a
2개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 0
      examples/js/animation/MMDAnimationHelper.js
  2. 2 2
      examples/js/animation/MMDPhysics.js

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

@@ -945,6 +945,9 @@ THREE.MMDAnimationHelper = ( function () {
 			}
 			}
 
 
 			if ( this.currentTime < this.delayTime ) return false;
 			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;
 			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.maxStepNum = ( params.maxStepNum !== undefined ) ? params.maxStepNum : 3;
 		this.gravity = new THREE.Vector3( 0, - 9.8 * 10, 0 );
 		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
 		this.world = params.world !== undefined ? params.world : null; // experimental
 
 
@@ -116,7 +116,7 @@ THREE.MMDPhysics = ( function () {
 
 
 			if ( isNonDefaultScale ) {
 			if ( isNonDefaultScale ) {
 
 
-				if ( parent !== null ) parent.parent = parent;
+				if ( parent !== null ) mesh.parent = parent;
 
 
 				mesh.scale.copy( scale );
 				mesh.scale.copy( scale );