I can’t figure out how to do the jump. I do understand there is a character controller in unity but it does no use root motion and the goal here is to learn root motion.
We use root motion with unity’s character controller. A lot of code is involved to “weave” everything together. Unfortunatly I can’t share this code but try it and if you have specific problems I’m sure I’ll remember how I fixed them.
Right now I have a forward jump animation, it look like I need forward, left and right to make a blend tree just for the jump. Is this correct? I thought that could be accomplished with only one animation, all I need is the character to keep its momentum and rotation and the same jump animation could be used.
You only need one jump animation, your navigation should allready steer the player in the proper direction, all you need is a layer set to override your nav layer and make sure its got a full body mask.
I suggest transitionning to your jumps from the any state node, itll be easier to manage. ALSO the import settings of your animations are extremely important, you need to RTFM here as you wont get anywhere if you dont get those right (especially the settings affecting root motion like “Bake into pose” and “Based upon”.
Another problem I see is the timing of the animation, the animation can finish and the player might still be in the air, like falling from a cliff. I think the best way to go is to use 3 animations, one for jump, on for midair and on for landing. I have no idea on how to accomplish that with root motion.
THIS is the hard part and most likely why everyone gives up on root motion jumping. I had this crazy Idea of manipulating animation data at runtime to match the jumps to the obstacles we were jumping and It works surprisingly well! But thats not code I can share at the moment. To clarify things, we still have 3 versions of each jumps for different heights but every jump in between heights uses this system + IK to position the hands.
Perhaps I should disable root motion for the animation during the jump and only use for when on the ground?
All depends how much time you got and how scared you are of R&D. I thrive on it.
I thought that could be accomplished with only one animation, all I need is the character to keep its momentum and rotation and the same jump animation could be used.
Animations dont transfer momentum to each other (they only appear to do so when in transition), depending on your animations and the results you are trying to get you sometimes need to manage momentum manually. I’m working on that right now for our falling animation that doesn’t inherit momentum from the long jump anim.
A few hints, momentum can be in the anim or added via code. To keep the orientation of the player at the moment of the jump, make sure the root transform rotation is set to bake into pose in the anim’s import settings, otherwise the animation data will apply any rotation data it has to the root of your player (changing its orientation).
Here is a video demonstrating an early version of the system wihtout IK
Good luck!