The character of Elda is created by Emma Hugin. Visit her site at ehugin.artstation.com
I wanted to create an animation driven locomotion system that feels rather heavy and realistic. I wanted to try applying additive animations and make use of IK handles.
I recorded myself in an XSense-suit doing the various transitions. I placed my starting transitions in 2 different blendspaces, one for starting towards each side. By checking the controller input in relation to the character I could play the appropriate animation in a blendspace and move the character using the root motion.
When the character is walking, I allow the game logic to rotate the character instead of the animations. I needed to keep track of different rotations, such as the capsule target rotation, the initial direction and the direction based on the initial capsule rotation. To to be able to change direction in the middle of a start transition I needed to update the capsules desired rotation calculated from its former rotation. Otherwise the wrong animation would play since the character is inside a blendspace. Therefore I wrote a function to quickly calculate rotations based on different parameters.
To play the correct transitional animations I relied on animation notifies to keep track on when and how animations can transition. All my states contain more states that put the character in the correct animation for left or right.
This is the state machine inside the StartWalk state. It is the only state where I allow left to transition to right and vice versa, in the case of the player wanting to change direction during startup.
There needed to be a lot of rules to be able to change direction realistically during the StartWalk-state
There was some slight foot gliding and I had an idea to use IK-handles to lock the feet in place whenever the they are planted. Every time a foot is planted, I save that position and interpolate the IK handle weight to avoid snapping issues.
Whenever an IK handle is active I check for height differences in the original animation. Both legs have one extra joint that is just the original animation. If the original animation lifts its feet above a certain threshold, I allow the IK handle to move by the same amount.
Finally to make the character more responsive I applied an additive blendspace that rotate the character towards the player's looking direction.