浏览代码

Get rid of "null" animation warnings.

These were coming from the initial setting of weapon, when there was no active animation yet (as behavior didn't get yet to select the animation state).
alteredq 13 年之前
父节点
当前提交
5ce5e4c67c
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      examples/js/MD2CharacterComplex.js

+ 6 - 3
examples/js/MD2CharacterComplex.js

@@ -248,9 +248,12 @@ THREE.MD2CharacterComplex = function () {
 			activeWeapon.visible = true;
 			activeWeapon.visible = true;
 			this.meshWeapon = activeWeapon;
 			this.meshWeapon = activeWeapon;
 
 
-			activeWeapon.playAnimation( this.activeAnimation );
-			this.meshWeapon.setAnimationTime( this.activeAnimation, this.meshBody.getAnimationTime( this.activeAnimation ) );
+			if ( this.activeAnimation ) {
 
 
+				activeWeapon.playAnimation( this.activeAnimation );
+				this.meshWeapon.setAnimationTime( this.activeAnimation, this.meshBody.getAnimationTime( this.activeAnimation ) );
+
+			}
 
 
 		}
 		}
 
 
@@ -258,7 +261,7 @@ THREE.MD2CharacterComplex = function () {
 
 
 	this.setAnimation = function ( animationName ) {
 	this.setAnimation = function ( animationName ) {
 
 
-		if ( animationName === this.activeAnimation ) return;
+		if ( animationName === this.activeAnimation || !animationName ) return;
 
 
 		if ( this.meshBody ) {
 		if ( this.meshBody ) {