Followers
Keywords:
animation,
dampers,
chasers,
interpolation
Author(s): Michael Zoellner
Date: 2007-06-12
Summary: This tutorial shows you how to use damper and chaser nodes for animation.
Introduction
Followers divide in Dampers and Chasers. They are an easy to use alternative for common X3D interpolators. You only have to define a destination value and the duration of the interpolation in order to create a tween. Instant Reality provides the following dampers and chasers:
- ColorChaser
- ColorDamper
- CoordinateChaser
- CoordinateDamper
- OrientationChaser
- OrientationDamper
- PositionChaser2D
- PositionChaser3D
- PositionDamper2D
- PositionDamper3D
- ScalarChaser
- ScalarDamper
- TexCoordChaser
- TexCoordDamper
PositionChaser3D
This is an example about a PositionChaser3D that lets an object follow the mouse pointer. Other damper and chaser nodes follow the same logic.
Initially only the PositionChaser's duration - the time it takes to get to the destination value - has to be defined.
Code: PositionChaser3D
<PositionChaser3D DEF='pc' duration='5' />
The mouse pointer's position on a plane is recognized by a TouchSensor and routed to the PositionChaser3D's destination value. By routing the PositionChaser3D's value_changed field to a Transform's set_translation the objects seems to follow the mouse.
Code: PositionChaser3D
<PositionChaser DEF='pc' duration='5' /> <Transform DEF='trans_box'> <Shape> <Appearance> <Material diffuseColor='0 0.329 0.706' /> </Appearance> <Sphere radius='0.25'/> </Shape> </Transform> <Transform DEF='trans_plane' translation='0 -0.25 0'> <TouchSensor DEF='ts' /> <Shape> <Appearance> <Material diffuseColor='1 1 1' emissiveColor='1 1 1'/> </Appearance> <Box size='10 0.1 10'/> </Shape> </Transform> <ROUTE fromNode='ts' fromField='hitPoint_changed' toNode='pc' toField='set_destination'/> <ROUTE fromNode='pc' fromField='value_changed' toNode='trans_box' toField='set_translation'/>