Animation AimUp & AimDown with the Mouse ?

help a beginner of a fps …

why only 1 animation works =?

function Start()
{
     // First set both animations layer value to something different to each other. This allows you to play them both at the same time.

 animation["aim"].layer = 1;

    animation["dodge"].layer = 2;
 
    // Second set both their speed to 0.
    animation["aim"].speed = 0;
    animation["dodge"].speed = 0;
 
    // Thirdly play both the animations
    animation.Play("aim");
    animation.Play("dodge");
}
 
// Use the mouse input to set the normalized time of the animations to what you want. Something like this.
 
var maxMouse : float = 366;

function Update()

{

    var newTimeAim : float = Mathf.Min(maxMouse, Mathf.Max(0, Input.mousePosition.y)) / maxMouse;

    var newTimDodge : float = Mathf.Min(maxMouse, Mathf.Max(0, Input.mousePosition.x)) / maxMouse;
 
    animation["aim"].normalizedTime = newTimeAim ;
    animation["dodge"].normalizedTime = newTimDodge ;
}

It looks like you’re trying to use additive animation with the legacy animation system.

Two points:

  1. Additive animations are based off of a non-additive animation, such as an idle or run cycle. You need to add a non-additive animation.
  2. You need to set the blend mode to additive. (Set the animation state’s blendMode to AnimationBlendMode.Additive)

For more info:

http://docs.unity3d.com/Documentation/Manual/AnimationScripting40.html#Additive