3D Theory - Animating a hand - a tutorial for interpolators

This section shows how to animate the 'hand' model that was created before.(to see how to build the hand, go here).

This technique is suitable for simple repetitive movements, but its not very good for physics simulations because you have to define start and end points, if you want to simulate physics or more complex movement, see kinematics tutorial.

First a simple animation, we can twiddle the fingers by using a simple looping behavior using a time sensor and interpolator.

This process can be partly automated as described here, but if you want to fully understand the principles continue with this page.

Start the program and load the hand model.

First insert a time sensor under the scene_transform, enable the cycleInterval, enabled and loop.

Set the cycleInterval to 5, this means that the fraction_changed will count up from 0 to 1 every 5 seconds.

Give this node a name such as 'timer1'. To do this double-click on the node in the tree control and enter the name - timer1. Then you must hit carriage return to enter the value. If you click on something else without pressing carriage return the entry will be canceled. Make sure just the name 'timer1' is in the edit window, delete the node type if it appears in brackets.

It is a good idea to enable fraction_changed and time, then you will be able to see the values changing. No need to enter any values yourself the values will be generated once this node is enabled.

Once the node is setup it should look as the screen shot below. (If you don't want to load the values yourself here is a file)

Now insert a orientationInterpolator under the scene_transform, this will take the fraction changed values and convert it into a sequence of rotation values.

Set its name to interpolator1.

Enable all the parameters.

No need to enter values into the 'set_fraction and value parameters, these will cycle through when the behavior is running.

Once the node is setup it should look as the screen shot below. (If you don't want to load the values yourself here is a file)

enter values into the key values by clicking on its edit button and then inserting some rows and giving them values between 0 and 1 as follows.

Now add corresponding values for the key values. Go back to the previous screen by clicking on another node in the tree control and then click back on the orientationInterpolator. Again click on its edit button.

Now insert some rows into the keyValues. There should be the same number of rows in the keyvalues table as in the key table. And give these rows some values as follows:

Now we have to patch the timesensor through to the orientationInterpolator using the nodenames, as in the screenshot below.

(if you dont want to load the values yourself here is a file)

And finally we have to patch the orientationInterpolator through to the transformGroup using the nodenames, as in the screenshot below.

(here is the final file)

You can now go on and animate all the other Joints yourself.


metadata block
see also:

hand model

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover If you are interested in 3D games, this looks like a good book to have on the shelf. If, like me, you want to have know the theory and how it is derived then there is a lot for you here. Including - Graphics pipeline, scenegraph, picking, collision detection, bezier curves, surfaces, key frame animation, level of detail, terrain, quadtrees & octtrees, special effects, numerical methods. Includes CDROM with code.

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

cover Dark Basic Professional Edition - It is better to get this professional edition

cover This is a version of basic designed for building games, for example to rotate a cube you might do the following:
make object cube 1,100
for x=1 to 360
rotate object 1,x,x,0
next x

cover Game Programming with Darkbasic - book for above software

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2017 Martin John Baker - All rights reserved - privacy policy.