This page shows how to animate an individual parameter by automatically adding
the correct interpolator and associated nodes. Multiple parameters can be animated
by repeating this procedure. If you wanted to add these nodes manually to understand
the issues more fully, this is described here.
We start the mjbWorld program and load a suitable model to animate, in this
case the model from the human
hand animation but it could be any model.
We then select the node which contains the parameter to be animated, in this
If, for example, we want to animate the 'rotation' parameter we click on the
square box next to 'rotation' as shown above.
When we click on this we get the following dialog box which gives information
about the parameter, in this case a 'SFRotation' parameter, but other types
such as 'SFVec3f', 'SFColor', etc. can also be animated.
We click on 'Animate' which brings up a further dialog:
This dialog allows us to specify information about the nodes generated as follows:
- 'Timer Name' - This is the name of the TimeSensor node that will generate
the events. It can be left with its default name of 'mainTimer' or changed,
if a TimeSensor with this name already exists it will be used instead of generating
a new one. If we are animating several parameters we can use the same TimeSensor
provided that all the animations have the same time period, if not we can
use a different TimeSensor.
- 'Interpolator Name' - The default name for the interpolator is the same
as the name of the node containing the parameter but with 'interp_' appended
to the front. Again the name of an existing interpolator can be used, however
this is only appropriate if the existing parameter and this parameter are
of the same type and move exactly in sequence and by the same amount.
- 'This Name' - This is the name of the node containing the parameter being
animated, in this case 'littlefinger'. Changing this will cause the node to
be renamed which may have effects on other aspects of the model. If the node
did not originally have a name it will get a default value something like
'tg_0_1' in this case it is best to give it a more meaningful name.
- 'Steps in animation' - This will set the array size in the interpolator,
in other words, the number of steps in the animation. The default is 8 but
any value above say 4 would be OK, a higher number will give a smoother animation.
When we are happy with the values set we can press OK to generate the nodes
As you can see in the screenshot above this will generate upto four nodes:
- a route from TimeSensor to Interpolator
- a route from Interpolator to node/parameter being animated.
To animate the movement click on the 'edit' button next to 'keyValue', this
will display a table as shown:
The default values in the diagram shows all values have x=0, y=0 and z =1,
this means that the rotation will be around the z axis, edit the values to change
the rotation. For other interpolators such as vector3d or color use appropriate
Click on the green 'play' button to see the animation.
This site may have errors. Don't use for critical systems.