Im trying to work with mecanim but its poorly documented and sparsely talked about. I have the model all set up, the animator states and the script. But it just wont transition the states. Im trying to make a small scene, player presses ‘W’ character walks forward. In the animator i have two states: Idle and Walk Forward. The trigger is float Speed, if the speed is greater than 0.1 the character moves, less than 0.1 character is idle, problem is, it just stays stuck in Idle, when running the scene and watching the animator the progress bar under Idle never starts. I think the script is the problem, but ive been at this for a while and im loosing patience.
And finally the script:
using UnityEngine;
using System.Collections;
public class AliceSpades : MonoBehaviour
{
public Animator Spades;
private float speed;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void FixedUpdate ()
{
if (Input.GetKey(KeyCode.W)) //if key is W change speed to trigger transition
{
speed = 0.2f;
}
else //else character is idle
{
speed = 0.0f;
}
Spades.SetFloat("Speed", speed);//update speed
}
}