Browse Source

fix MorphBlendMesh start animation playing

bugfix: When currentFrame == animation.lastFrame then first animation frame is rest pose.
ostolop 10 years ago
parent
commit
c966c3554f
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/extras/objects/MorphBlendMesh.js

+ 6 - 2
src/extras/objects/MorphBlendMesh.js

@@ -299,8 +299,12 @@ THREE.MorphBlendMesh.prototype.update = function ( delta ) {
 
 		if ( animation.directionBackwards ) mix = 1 - mix;
 
-		this.morphTargetInfluences[ animation.currentFrame ] = mix * weight;
-		this.morphTargetInfluences[ animation.lastFrame ] = ( 1 - mix ) * weight;
+		if (animation.currentFrame !== animation.lastFrame) {
+			this.morphTargetInfluences[animation.currentFrame] = mix * weight;
+			this.morphTargetInfluences[animation.lastFrame] = ( 1 - mix ) * weight;
+		} else {
+			this.morphTargetInfluences[animation.currentFrame] = weight;
+		}
 
 	}