Hi,
I would like to activate a Trigger in Mecanim by pressing mouse 0. How do I script this in Javascript?
I imagine it would involve:
if(Input.GetButton("Fire1"))
{
animator.SetTrigger(I don't know what to put here)
}
This is what I got so far:
#pragma strict
var animator : Animator; //stores the animator component
var v : float; //vertical movements
var h : float; //horizontal movements
var sprint : float;
var r : boolean = false;
function Start () {
animator = GetComponent(Animator); //assigns Animator component when we start the game
}
function Update () {
v = Input.GetAxis("Vertical");
h = Input.GetAxis("Horizontal");
Sprinting();
Firing();
Reloading();
}
function FixedUpdate () {
//set the "Walk" parameter to the v axis value
animator.SetFloat ("Walk", v);
animator.SetFloat ("Turn", h);
animator.SetFloat("Sprint", sprint);
animator.SetTrigger("Fire"
}
Do I need to include variables for this? If so then what? Thanks.