Ver código fonte

Merge pull request #15335 from panxinmiao/mmd-physics-fix

Normalization is needed after quaternion multiply
WestLangley 6 anos atrás
pai
commit
5ff8f67875
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      examples/js/animation/MMDPhysics.js

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

@@ -1052,12 +1052,12 @@ THREE.MMDPhysics = ( function () {
 			thQ.set( q.x(), q.y(), q.z(), q.w() );
 			thQ2.setFromRotationMatrix( this.bone.matrixWorld );
 			thQ2.conjugate();
-			thQ2.multiply( thQ );
+			thQ2.multiply( thQ ).normalize();
 
 			//this.bone.quaternion.multiply( thQ2 );
 
 			thQ3.setFromRotationMatrix( this.bone.matrix );
-			this.bone.quaternion.copy( thQ2.multiply( thQ3 ) );
+			this.bone.quaternion.copy( thQ2.multiply( thQ3 ).normalize() );
 
 			manager.freeThreeQuaternion( thQ );
 			manager.freeThreeQuaternion( thQ2 );