- Home /
Rotate and run animation difficulties - Please help:)
Hi there!
I am currently using Mecanim animations to run forward, backwards, to the left and to the right, using my PC's arrow keys. The problem is that I have to be running forward or backwards in order to turn. What I mean is that I need to press the up or down arrow keys for the left or right arrow keys to function. This is really inconvenient as my game is relatively narrow and the character does not cover big distances. What I would like is for the character to pivot to one side while running when I press the left or right arrows.
I have tried rotating the player with code, which works well, only the legs of my player don't move when rotating, which makes the whole thing look unnatural. Also, I am not sure how to go about adding running motion to this action.
I have also followed this tutorial (https://www.youtube.com/watch?v=zy9E-w4QM2o) which does exactly what I want, but it is for use with an XBox controller, which is not what I am using.
I have also looked for animations that would do what I need, i.e. rotate and run from an idle position, but no luck. I looked mainly here: https://www.mixamo.com/ as well as googling it.
If anyone has any ideas, I would be really grateful. Ideally, I would like my character to move in the same way as Super Mario in the above YouTube tutorial (right at the beginning), but using my 4 arrow keys. Is it feasible?
Cheers!
Hey, when you press left & right keys, try also setting the some bool (animator.SetBool("name", true)) parameter inside your animator, when the bool is true, run the turning animation. When false, slowly transition out of it.
Answer by Strangerweather · Feb 08, 2016 at 05:35 PM
Well, problem solved. Using the Unity third-person controller did exactly what I wanted, and it's so much easier!