Quellcode durchsuchen

make it easy to synchronize to actions together.

Ben Houston vor 10 Jahren
Ursprung
Commit
32befcc1a4
2 geänderte Dateien mit 9 neuen und 1 gelöschten Zeilen
  1. 1 1
      examples/js/MD2Character.js
  2. 8 0
      src/animation/AnimationAction.js

+ 1 - 1
examples/js/MD2Character.js

@@ -190,7 +190,7 @@ THREE.MD2Character = function () {
 			var clip = THREE.AnimationClip.findByName( this.meshWeapon.geometry.clips, clipName );
 			if( clip ) {
 
-				var action = new THREE.AnimationAction( clip, this.meshBody.activeAction.startTime ).setLocalRoot( this.meshWeapon );
+				var action = new THREE.AnimationAction( clip ).syncWith( this.meshBody.activeAction ).setLocalRoot( this.meshWeapon );
 				scope.mixer.addAction( action );
 
 				this.meshWeapon.activeAction = action;

+ 8 - 0
src/animation/AnimationAction.js

@@ -106,6 +106,14 @@ THREE.AnimationAction.prototype = {
 
 	},
 
+	syncWith: function( action ) {
+
+		this.actionTime = action.actionTime;
+		this.timeScale = action.timeScale;
+
+		return this;
+	},
+
 	warpToDuration: function( duration ) {
 
 		this.timeScale = this.clip.duration / duration;