extracted from my post here: https://www.reddit.com/r/godot/comments/199l8qf/people_were_annoyed_that_i_said_aaa_procedural/
This isn’t a full procedural animation, it is only a procedural animation adjustment like the hand IK for pickups, this corrects the character legs to walk on slopes (common in video games), and also does something called “Stride Warping”
Stride warping is basically when you walk, you extend your legs to walk in the ground, right ?
As we know animation in engines is static, so if the character is moving fast relative to the animation, the character will look like sliding or moon walking, so stride warping adjust the leg extension to reach a more realistic look for character normal animation without adding a gazillion animation for each speed.
Stride warping + Orientation Warping + Slope Warping + Start/Stop/Pelvis are all part of a system developed by an epic games game developer, the system is called “Distance Matching”.
Sounds familiar ? Sound like “Motion Matching”
Yes because it was inspired by it, but as you know motion matching is developed by Ubisoft, and it is different because it requires good and a lot of mocap data to achieve good looking animations, not so good for indie teams.
I can’t also explain how motion matching works so I can keep this post as short as I can.
Distance Matching tries to do something different to motion matching, it tries to modify the character pose (keep “Pose Warping” naming in mind)
So Distance Matching tries to:
1- Fix character current pose so it makes the animation match the character speed through stride warping, and adapts the character to the environment through slope warping.
2- compensates for directional animation by using only 2 or 4 animations (forward and backward) mainly and optional providing (right and left)
It compensates with Orientation warping, for how it works check out my video:
Advanced Movement template in Godot Engine 4 Showcase
3- achieve good start/stop/change direction 180°
4- good rotation in place/ movement turn (movement turn is also related to point 3)
For more info check this talk by the developer himself:
[Nucl.ai 2016] Bringing a Hero from Paragon to Life with UE4
Now what is the current state of my project on this topic ?
I implemented Stride + Slope + Orientation warping, all are in one Godot Engine Node called
“Pose Warping” (remember the naming ?)
You only create two SkeletonIK 3D one for the Left Leg, one for the Right Leg, and then add “Pose Warping” Node to the Skeleton3D.
Assign SkeletonIKs to Pose Warping (in the inspector), assign the character node (CharacterBody3D or RigidBody3D).
Voilà it will just work!
What ? No need for tedious setup ?
No I handled everything internally, if you setup the SkeletonIK3D right, and provide the correct hips bone name and spine bones to the Pose Warping Node (also through the inspector), and just provide the “character_velocity” from your movement script (in my template I am providing it from my CharacterMovementComponent, but in case someone doesn’t want to use my MovementComponent I made this this way (more generalized).
Everything should work fine, if something doesn’t, it is either the animation is incompatible (like the feets barely move up from the ground, but this means this is just bad character animation, who walks by barely moving up from ground)
Or you need to just change raycast length also through the inspector of Pose Warping Node :)
So now I am in the state of polishing it, and working on start/stop/turn animations, and creating custom animations.