Hi
Trying to transition from a run to a walk. The walk to run goes great but the mecanim state transition back to walk from run just leaves the run looping, or not returning to walk. The conditions for the transition back is ‘Run’ ‘false’. The jump isnt working either.
Here is what I have any help appreciated.
// Update is called once per frame
void Update ()
{
if (animator)
{
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
if (stateInfo.IsName("Base Layer.Walk"))
{
if (Input.GetButton("LeftShift")) animator.SetBool("Run", true);
if (Input.GetButtonUp("LeftShift")) animator.SetBool("Run", false);
if (Input.GetButton("Fire1")) animator.SetBool("Jump", true);
}
else
{
animator.SetBool("Jump", false);
}
if(Input.GetButtonDown("Fire2") animator.layerCount >= 2)
{
animator.SetBool("Hi", !animator.GetBool("Hi"));
}
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
animator.SetFloat("Speed", h*h+v*v);
animator.SetFloat("Direction", h, DirectionDampTime, Time.deltaTime);
}
}
}