- Home /
How do you animate/transition a jogging character to a stop believably?
Perhaps this is primarily an animation question, or about how to divide up my animations/which animations to make. Anyway, currently I have a humanoid player character in my game with Idle and Jog animation states using the Animator. You can assume I have a pretty good understanding with setting up the transitions/states in my AnimatorController, as well as programming to implement the functionality and use the Animator through C#.
My main question is: how do I make the transition from Jog back to Idle look less abrupt, and more intentional or believable in my game? When I just use a literal animation transition in Unity, the linear interpolation between all the bones' positions/rotations ends up not looking natural if the jog is cut mid-way with the legs out in front/back, because the legs somewhat "magically" move to their positioning in the Idle animation.
The gif shows the character starting out jogging, and then stopping. Notice the legs when the character is jogging, and begins to stop moving, going towards the Idle animation.
I've thought of a couple of ideas, but I don't want to commit to them and waste time before getting others' advice! These were my ideas for possible solutions:
1. Should I make a third animation like "Jog to Idle" that has my own animation to make them step a few times from the jogging into my idle animation's stance?
2. Should I only allow Jog to transition to Idle during points in the Jog animation where the legs are in-between where it'd make sense to be able to stop? (Though since this is a player, they might want to stop when they want to, so I don't wanna exactly limit too much when they can stop moving? I think?)
3. Should I just shorten the transition time, because no one really cares anyway? Lol XD Could this even generally accepted be accepted well by players? [EDIT] I just tested this, and it looks way too fast/abrupt when I shortened the transition duration from the default 0.25 down to something around 0.10.
Would either of those 3 solutions be good, or is there something even better that you'd recommend me do? Thanks in advance for your help! :)
[EDIT 2] - I am currently finding an optimal solution for my scenario, and it's kind of a mixture of all three of those solutions, plus some additional stuff. It's complicated so once I finalize my results and get something I'm happy with, I'll be able to share my findings! :) In the meantime (and afterwards too), I'm still open to hearing your suggestions/solutions too!
There should be transition times that you can set on your animation. Click on the arrows connecting the Run to the idle animation and select the arrow. There should be a transition time. If not I would use Input.GetAxis("Vertical");
to handle forward movement and have the animation trigger only change when input is 0. That will give you a good stopping effect. I use that and always works well for me.
Oh yeah, my script was already setup, generally speaking. Though you did point me in a good direction, cause I noticed that a parameter (in my AnimatorController) that was controlling the playback speed of my Jog state!
The float parameter controlling the speed of my Jog state was being smoothed down from 4.5 (which was a speed in world units, so 4.5 was measured in world units per second) to 0 towards the end of the Jog, which was slowing down the animation playback towards the end of the Jog, and did make it look slightly delayed. I ins$$anonymous$$d made it stay at 4.5 until after the Jog completely finishes, so the animation does not slow towards the end.
Oh and the transition time -- I did try with Exit Time and it added delay to getting to stop the Jog. If you meant the Transition Duration, I actually did find that having that around 0.15-0.20 seconds works well if I use an intermediate animation "Jog to Idle" to transition my character to Idle, in a way that's more in-character for them than just using a literal "Transition" that simply interpolates from my "Jog" to "Idle" (as shown in the gif image in my original post above), if that makes sense.
Thanks for your reply by the way! :)
Haha unfortunately not. My latest projects have been with 2D and pixel art.
Goodluck!
Answer by SteenPetersen · Apr 06, 2021 at 07:27 AM
I think what you are looking for is the use of Blend trees in your animation.
https://www.youtube.com/watch?v=m8rGyoStfgQ
https://www.youtube.com/watch?v=HeHvlEYpRbM
Your answer
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
Unity 2D Play animation by time event 0 Answers
Smooth transition with Animator.Play or similar? 2 Answers
Mecanim, Share Transitions? 0 Answers
Action Game - Character Dash (Plz Help) 0 Answers