Answered

Leaning While Running and Climbing

Michael L Croswell 3 years ago updated by Peter - Soxware Developer 3 years ago 2

Hello!  I finally have some time between my programming jobs to work again with UMotion Pro and wondered:

1) Do you have (or know of) any tutorials showing how to lean characters when running or climbing?  I want to blend a lean and have the lean based on speed and the sharpness of the turn.  Also, for walking up/down stairs want to lean toward the slope somewhat.

2) If not, do you have any suggestions to an approach?

Thank you for a great tool, too!

UMotion Version:
UMotion Pro (Latest)
Unity Version:
Latest

Answer

Answer
Answered

Dear Michael,

thank you very much for your support request.

As the amount of the leaning is dependent on the current runtime situation, you can't do this in a static animation file (otherwise the leaning amount would always be the same). Thus using UMotion Pro for this won't work. I haven't done something like this myself yet, but I think your best bet is to do this via code in your character controller.

A quick search gave me this video tutorial which might be helpful:

Please let me know in case you have any follow-up questions.

Best regards,
Peter

GOOD, I'M SATISFIED

Thank you Peter!

The video is fine but it's someone else's ("Fimpossible Creations") tool.  On sale, it is only about $6 US dollars and certainly a good value but I am interested in making my own for learning purposes. I may just buy it to have it around for future production purposes.

Anyway, for making my own, I was thinking my approach would be to add a leaning animation (using UMotion)but as a layer. Then I would create a mask for the bones I don't want to affect, then based on the forces I would programmatically change the weight value of the layer. Some LateUpdate() or IK Callback tweaks may be required for IK of the feet.

Additionally, thinking back to the video, if one uses the new Unity Starter Pack, getting the feet to not slide and match the terrain are their own issues, but I may use some earlier animations from the older standard assets or from Mixamo that are better.  It would be good to integrate with the Unity Starter Pack since the new input system is used.

My goal is to share this with others in my Unity SIG, fyi, so the educational aspect is more important than perfection, fyi.

Also, since I'm between contracts this should be a fun challenge for myself.


Best regards to you as well,

Mike Croswell

Satisfaction mark by Michael L Croswell 3 years ago
Answer
Answered

Dear Michael,

thank you very much for your support request.

As the amount of the leaning is dependent on the current runtime situation, you can't do this in a static animation file (otherwise the leaning amount would always be the same). Thus using UMotion Pro for this won't work. I haven't done something like this myself yet, but I think your best bet is to do this via code in your character controller.

A quick search gave me this video tutorial which might be helpful:

Please let me know in case you have any follow-up questions.

Best regards,
Peter

Oh sorry I wasn't watching the whole video so wasn't aware that it is using a third-party asset. Yes, doing it with a "leaning" layer in the animator controller should work. I wish you all the best for this project, I'm sure you're going to learn a lot doing this on your own.

Best regards,
Peter