Blog

Creating an Animated Tortoise Part 2

2014-05-30

In the first part of this tutorial we saw how the model of a tortoise was created and textured. The next steps will be: rigging, animation, NLA setup, baking and exporting.

Rigging

The rig is specific and reflects an anatomic features of a real tortoise: the low flexibility of feet, limited movement, a special structure of the spine which allows to pull the head in. Also it allows for swaying the body to and fro, pulling the head and neck in and out, turning the head around and controlling the limbs. A special bone in responsible for the sniffing function - periodical tension in the lower part of the neck.

Animation

Animation is performed through inserting keyframes and editing F-Curves.

Two objects are animated: the armature (mediterranean_tortoise_rig) and the sand surface (ground). 6 actions altogether were created for the armature: the tortoise can hide itself (hiding), stick its head and paws back out again (unhiding), lie (lay), walk (walk_cycle), and also there are two transitions: from lying to standing and back (lay_to_walk, walk_to_lay).

It's necessary to bake the actions after creating them. To do this select the armature, on the tool panel (T) switch to the Blend4Web tab and expand the Bake Skeletal Animation panel. Then we need to assign the animations which correspond to our armature: click plus button and type an animation name in the shown up window. After that the animation baking tool will work correctly with multiple animated objects. When all the animations are listed - press the Bake button.

After that you will see new actions labelled "_B4W_BAKED" in the actions drop-down list - baked and ready to be exported into the engine.

If you use inverse kinematics and other constraints for rigging, the baked actions are rendered incorrectly in Blender (when applied to the armature). The baked actions will be played back correctly in the scene viewer though. Also, you should not edit the baked animation sequences (i.e. change the keyframes), because they are intended only for exporting to the engine.

Not only the tortoise is animated but also the sand surface. It is moved with object animation called ground_moving. Also the settings for lighting surroundings, environment and NLA tracks should be tweaked before exporting the scene.

NLA Setup

Now we have all the objects in the scene, they are animated and the animations are baked. Lets setup NLA (Non-Linear Animation) tracks - make the animation tracks arranged in certain order while the sand surface animation corresponds to the tortoise's walking cycle. We can use both original and baked animations for that. For settings check the picture below:

Export

After everything is ready, export the scene: File -> Export -> Blend4Web (.html).

Conclusion

With Blend4Web you can create animations of any complexity level. Baking doesn't require any special skills and takes up a couple of seconds. The resulting animations can be exported directly into the engine or can be first combined with other objects' animations and/or audio through NLA.

Link to the interactive scene

You can find the source blend file in the following directory: blend4web/blender/tutorials/basic/mediterranean_tortoise_2/.

Changelog

[2014-05-30] Initial release.

[2014-06-24] Because of new animation baker functionality available, the corresponding text and pictures were updated.

[2015-05-29] Because of new NLA functionality available, the screenshot showing NLA settings was updated.

[2015-09-10] Text and screenshots were updated because of the new interface.

[2017-01-12] Fixed incorrect/broken links.