YAMR: All animations done
The last few days I was busy animating characters and other objects and making cutscenes for the game. And just as the title of this blog post says: "YAMR" (Yet another milestone reached). All animations for the game are done and included into the game.
Bringing in a new animation into the game and using it involves several steps:
1. Creating the animation in Blender
Blender is the 3D modeling software I use. I developed a very complicated rig for the worms to animate them, which contains four important parts:
- A control rig that has control points that are used to make the animations. These control points are the only objects that are touched or changed when animating.
- A bezier curve that is controlled by the control rig. That means the control points/handles of the control rig "draw" this curve.
- An intermediate (Spline IK) rig that consists of bones that follow the bezier curve.
- A deform rig that has the same amount of bones as the intermediate rig, but these bones are constrained or connected in another way. The deform rig is what finally gets exported to Unity to be used in the game.
Building this complicated rig was six month of work, but it had to involve so many components to work properly in Unity.
After a new animation is done it has to be "baked" from the control rig to the deform rig. Baking means that the bone positions of the intermediate rig are copied to the deform rig frame by frame for the length of the animation. This step also transforms inverse kinematics to forward kinematics. This may be a bit technical but if you want to know more about rigged animations, forwarded and inverse kinematics there are a lot of sources all over the internet. It would go beyond the scope to explain all the involved technologies here.
2. Importing the animation into Unity
After exporting the new animation from Blender it has to be imported into Unity. That step is very simple and forward. Just copy the animation file over to the project, change some import options and done.
3. Programming the Animator Controller
For an animation to be used by the Unity Engine or by a character to be more specific it has to be programmed into a so called Animator Controller. This is an animation state machine that code of the game to let the worm do the fancy things the do. You can imagine it as a completely seperate program that runs in the background that handles all the animation stuff: Playing an animation, blending from one animation to another and other things. The Animator Controller contains many layers and so called State Machines and Blend Trees. This is how the base layer of a character Animator Controller looks like:
On the left you see a list of parameters which are used to control the animations from code. Those parameters can be of different types such as Boolean, Integer, Trigger and others. The first parameter "MoveSpeed" for example is of type float and controls if the character stays still (Idle state), walks or runs, dependent on the value of the parameter. A value less than 0.1 means the character plays its idle animation. A value between 0.1 and 2.0 lets the character walk with the speed set by the value. A value greater than 2.0 lets the character "run".
And this is just the layer with only the one-shot animations:
This is the layer for loops and states:
And yes, there are more layers and there are layers that control different body parts to make a character shake his head while walking for example. It's very complex.
4. Using the animation in Adventure Creator's visual scripting system
Once all preperation is done it is quite easy to fire up an animation in the game. The action "Character: Animate" for example triggers the "Take something" animation based on the position I give it:
Posts in this Series
- MacOS support dropped
- Wormventures GIF-away #7
- Current statistics
- Steam page now available in french, spanish and portuguese
- Wormventures GIF-away #6
- Wormventures GIF-away #5
- First complete playthough and playtime
- Wormventures GIF-away #4
- Wormventures GIF-away #3
- Second Trailer released
- Wormventures GIF-away #2
- Wormventures GIF-away #1
- Talking italian
- My Sabbatical is over
- YAMR: All animations done
- Fear scenes
- All characters done
- Unity, the killer
- The Briefing Room and more characters
- Translating recipes
- Translation work
- My workplace for the next weeks
- A new procedural sky system
- One month of fulltime development
- New gameplay video with german voice overs
- German Voice Overs / Longer Demo Version
- Game not coming in 2022
- Stormworm is back
- Demo version updates
- Talking about UI: Inventory
- Demo version playthrough on YouTube
- Demo version updates/bug fixes
- Demo version ready for beta testing
- Scene Evolution
- Worms, worms, worms – They multiply!
- Worms that learn to run
- The longest journey (an adventure game ever made)
- Crawling into the light: Wormventures – Barrier 51