Yeah, I’m abuzz with a lot of scripting stuff aren’t I? (Never was too good at script) Anyways, this should be a quicky, I need my scripts to figure out which direction I’m telling my character to go in so that I can give hm different animations and different speeds. Obviously we can’t run at full speed when walking sideways, and I really don’t want my character to run as fast backwards as it can forwards.
What I have are four animations, Run, WalkBack, Strafe-Left, and Strafe-Right. If I’m going straight to the left I want my strafe-left animation to play, and so on and so forth (kind of obvious what animations I want to play when). I originally have “if (Mathf.Abs(Input.GetAxis(“Vertical”)) > 0.2) animation.CrossFade(“run”);” this gives my character a ‘lurch’ into the run animation, and not just going off if I tap the forward button, but it doesn’t determine whether I have forward or backwards down, as it plays the run animation whether I’m going backwards or forwards.
The same problem exists in determining the speeds. even if I have it check if my direction is negative (if vertical is < 0) it still runs at full speed, with this being said the same -WILL- happen if I start playing with my horizontal axises, as it will always see the movement in a positive direction (kind of awkward, but it will).
Anyone know of a way for my scripts to “see” which direction I’m going in and play the correct animations and speeds?
EDIT:
Nevermind, I found a solution, it’s a little messy, but it works. I just created duplicate buttons of the four directions and whenever I have those certain buttons down it’ll play those animations.