Animator Condition not working correctly!
Hello,
im struggling with a problem: I have my character with the body, and an Aniamtor for the body. I have a animator parameter called MovementState (int). So i want that if MovementState Equals 0 it plays the idle animation, if MovementState is 1 it plays the walk anim and if MovementState is 2 i plays the run anim. Thats working correctly with idle and walking but it just wont player the run animation :( I dont know whats wrong.
Heres my animator: http://prntscr.com/hpmhh9
Heres my animation script wich set the int MovementState:
if (controller.velocity.magnitude > 0.3f && grounded)
{
RaycastHit hit;
if (Physics.Raycast(transform.position, Vector3.down, out hit, 1.5f))
{
switch (hit.transform.tag)
{
case "Soil":
RequestFootstep(dirtWalk);
break;
case "Stone":
RequestFootstep(stoneWalk);
break;
case "Snow":
RequestFootstep(snowWalk);
break;
case "Wood":
RequestFootstep(woodWalk);
break;
}
if (!footstepsAudioSource.isPlaying)
footstepsAudioSource.Play();
}
if (running)
firstPersonBody.SetInteger("MovementState", 2);
if (crouching)
firstPersonBody.SetInteger("MovementState", 3);
else
firstPersonBody.SetInteger("MovementState", 1);
}
else
{
footstepsAudioSource.Pause();
firstPersonBody.SetInteger("MovementState", 0);
}
Best Regards,
K
Your answer
Follow this Question
Related Questions
How can I animate a button that is a child of a canvas? 1 Answer
How to let animation play to the end before playing the next one using button 2 Answers
Animation event call the function but the animation isn't playing 0 Answers
Rootmotion orientation won't change 0 Answers
How To preserve Forward momentum of an anim throughout another anim? 0 Answers