how to stop animation win javascript code?

hello i’m working on a game, i have used the base first person controller and have modified it to use as a third person view because i wanted to see my player on the game and move the camera with the mouse.

now i’m trying to setup the animations of the player in the same way that was made on the default third person controller, i have already done that, but when i start the game the player is playing all the entire clip of the fbx animation, i have used

animation.stop();
animation.Stop("Take 001");

both didn’t work, i’m trying to make the player on idle when the game start and then when he is moving i want to play the walk animation, but the player is always playing the entire fbx animation clip ?

any ideas on what i need to use to stop the default animation to let me use all others animation from the clip ?

thanks in advance for all the help.

I think you use animation.CrossFade(next animation);

didn’t work, this is my code

public var idleAnimation : AnimationClip;
public var walkAnimation : AnimationClip;

public var AnimationSpeed : float = 1.0;
private var _animation : Animation;

function Awake ()
{
	_animation = GetComponent(Animation);
	_animation.CrossFade(idleAnimation.name);
	if(!_animation)
		Debug.Log("The character you would like to control doesn't have animations. Moving her might look weird.");
	
	if(!idleAnimation) {
		_animation = null;
		Debug.Log("No idle animation found. Turning off animations.");
	}
	if(!walkAnimation) {
		_animation = null;
		Debug.Log("No walk animation found. Turning off animations.");
	}
			
}

any ideas on why this is not working ?

What were you trying to do again? Crossfade is for going from one animation to another, like idle to walk. The animations are generally set to loop, and then when you change to another animation, you crossfade to the next. Maybe read up on animations in the manual, but they changed to Mecanim now, which is pretty cool really. You might want to look at it. There is a tutorial but it’s a little complex, but you just add transitions and then I use a state like characterState as an int. Then I just set the transitions for a different int value of that variable and it crossfades the animation.

i will try to check the Mecanim tutorial, thanks