Controlling Mecanim through javascript?

I have been wrestling with the Mecanim animation system in Unity for the last week and half. I downloaded the Unity tutorial on it, but all the control scripts were in C#, which I am not very good at. After some browsing on the topic, I realized how little information there is when it comes to Mecanim and javascript. I have figured out the blend tree system, but I cannot control the Animator with a script. Could someone explain to me how to change parameters in a blend tree through javascript? I am sure that i’m not the only one that has struggled with this…

please attach an example of a simple parameter change, like transitioning from idle to walking, or walking to turning.

Thanks for the help :slight_smile:

Nothin in the Animator setup is language specific.

Create your states, your parameters etc.

then you can set the parameters like this from your script:

var anim = GetComponent(Animator);
anim.SetFloat("speed", yourSpeed);

You can always play with the Input.GetAxis(“Vertical”) and Input.GetAxis(“Horizontal”). Create two float parameters and set the transition condition according to the values. Pass the values of the Input and things should work.