Cartoony animations with all their exaggerated moves, squash and stretch and snappy feeling have always made me happy, but I hadn't really tried making any myself. I wanted to try that in this project and I wanted it to work in a game environment. I wanted the character to move seamlessly and I didn't want to lock the player in animations or remove the player control of the character.
To allow seamless movement, almost all animations exist in blendspaces that is driven by a speed value. The speed value is taken directly from the characters forward velocity.
The different states contain nestled state machines to allow for a easily readable flow and sharing of transition rules.
This is the main state machine. All of these states except JumpOff contain another state machine.
This is the state machine inside the Jumping/Falling-state. I use an empty state I call "start" to branch off to other states.
The climbing is done by line tracing forward while holding the climb button. If the trace touches any surface, the character will snap to that point, rotate towards the wall and start climbing.
If the line trace returns false during climbing, the character will enter a "climb up"-state. Since I had to do alot of traces, I wrote a little function for it.
To climb up the edge, I use a timeline to move the character towards a good spot to land on. Since I wanted the climb to work with scaling walls as well as vault over smaller obstacles, I needed way to cancel the climbing up and enter freefall. By tracing downwards, I can see if the character will touch the ground or not. If not, I will set the movement to falling. I did however find this a little disruptive, so then I also check if the player has input forward. In that case give the character a small boost forward. It got a little messy but it got the job done.
I use two different timelines for the XY-movement and Z-movement to avoid clipping through the ledge and stale movement.