How to make character animate as he's rotating?
Hello,
I am currently trying to figure out how I would script a character to animate as he is rotating in place. I have the basic move and jump scripted but I cant seem to get the turn working. I am using C#.
Answer by G-Reusch · Nov 18, 2016 at 11:41 PM
You didn't really mention what kind of animation you're trying to implement, but usually an Animator component is what you want when you need multiple animations for a character. You can make states in the animator window that represent moving, jumping, etc, and you assign a different Animation Clip to each state that makes the character rotate (or whatever you want them to do).
Answer by terry213 · Nov 19, 2016 at 11:47 PM
I have a "run", "idle", and "jog" animation, and I wanted the character to jog as the player presses left or right. Would I need a boolean statement in there somewhere? and since he turns in place speed wouldn't be a parameter, right? @G-Reusch
I would make a state in the animator for idle, and a state for jogging, and pass your horizontal axis in as a float to control the direction and speed.
Thanks! But How what value would I give the float parameter in the Animator? @$$anonymous$$Reusch
Your Input manager should have a field for "Horizontal Axis" that represents left to right movement. You put whatever keys/joysticks you want for it, and it gives you a value between -1 and 1. -1 is left, 0 is still, 1 is right.