How the procedural animation of the skateboarder works!
For Godot Wild Jam 69 I really wanted to use procedural animation. I had been learning about it for the last month and felt I was ready for a test. The Jam's theme is "void" and initially I was satisfied with a monster horde game, I could animate the monsters procedurally. I felt this idea was too obvious and many other jammers would be making void monster games which would be dark and sad. I felt something more surprising would be a skateboarding game with a more optimistic vibe. A game about movement is a good one for a game jam, I focused all my effort on the movement and animation of the skateboarder (B26 as Dan Starflow named them). As a kid some of my fondest memories are playing the Skate games at my mate's house. I've always wondered how the animation in those games worked. It's still a mystery to me lol, I couldn't find an article by the developers, but in developing GRAIL I created one technique.
B26 is entirely procedurally animated. This starts with a procedural rig which is just a set of points I use to mark key points in the body. In Godot I use position3D nodes as these points and I parent them in a way that is logical / makes the animation work. B26's procedural rig has the following positions: shoulders, hands, hips, feet, and pelvis. There are also positions for IK magnets which make sure elbows and knees don't bend backwards. When the game starts, these positions are used to initialize the rig and provide target positions. I'm going to describe the rig using 3 procedural animation systems:
* IK System
The IK system is my tweaked implementation of FABRIK. It doesn't use any nodes as I prefer code to nodes (Nodes in a scene can differ from code and annoy me). FABRIK can also use IK magnets which pull joints towards them which I use to avoid unnatural elbow/knee bending. IK is used for the arms and legs of the rig. The leg IK goes from the hips to the feet, which are parented to the board. So when the board moves, the legs bend! The arm IK is from the shoulders to the hand particles which will be described next. Useful reference:
http://www.andreasaristidou.com/publications/papers/FABRIK.pdf
* Particle System
The particle system is a Verlet particle system described in this paper: Advanced Character Physics (cmu.edu). It is really simple to implement and again Its all in a single GDScript file because I hate nodes (not really). I use a single particle system to simulate the torso (pelvis and shoulders) and hands. I create constraints between the pelvis and the shoulders, between the shoulders, and between the shoulders and the hands. When running the pelvis is an anchor and stays where the pelvis should be, I apply forces to make the shoulders and hands go to their initial position. Depending on how strong the forces, when the body is in motion the particles will lag behind the goal positions or overshoot them. These particles provide what animators might call anticipation and overshoot. They give our rig a feeling of intertia and physicality.
* Spring System
Lastly, because the pelvis is an anchor it doesn't move, however, when we jump or land the pelvis should bob and provide a lot of secondary motion on the leg IK and arms. To do this I added a spring based on this article/video: www.gamedeveloper.com/game-platforms/instant-game-feel---springs-explained The purpose of the spring is control the up and down motion of the pelvis. My spring tracks the height of a root position, which serves as the ideal pelvis height. Then I set the pelvis height to the spring value.
Thats all of it. The second challenge is controlling these systems to create the look of a skateboarder, for example: tilting the board when it is moving up or down, twisting the board into a turn, leaning and twisting the body into a turn. These are all just knobs I turn based on the state of the physics controller and player input. Also the physics controller was perhaps harder than all the procedural animation, it is a kinematic controller, not a rigidbody, and it was a real bitch to figure out. Anyway, hope you enjoyed this little tech discussion on the procedural animation systems in GRAIL! Sub to my YT and see ya!
Upakai / Riordan
GRAIL
Arcade Style Skateboarding Game
Status | Prototype |
Author | Upakai |
Genre | Platformer |
Tags | 3D Platformer, Skating |
Leave a comment
Log in with itch.io to leave a comment.