Home

hersto:  How to use the Dampers

 

Rant to the author:

    

Check for a response

Please note that This document is no longer up-to-date.

This document is still valid in terms of the idea it coveys. However, meanwhile there has been published a paper that covers the same topic in a more general and comprehensive way.

To the paper: Linear Filters - Animating Objects in a Flexible and Pleasing Way

If you decide to continue reading this document, please keep in mind that now some fields have changed their name, and that besides Damper nodes there is also the class of Chaser nodes.

 

 

Case 1:  A Simple Door.

Making a door that opens or closes when the user clicks on it, depending of whether it is already open, is a simple task in VRML. (As it should be.) One uses a TouchSensor, an OrientationInterpolator for the opening animation, another OrientationInterpolator for the closing animation and a Script node for deciding which of the two animations should be started.

However there is a problem:
What happens if the user clicks on the door while the door is moving from one state to the other? With standard nodes in VRML it is not easy to make this animation realistic. Depending on how, and whether the author tries to circumvent this lack of realism the door jumps from one position to another, or simply does not react to the users mouse click.

 
See this example:
    Door-Classical.wrl

It shows an animated door based on the node structure shown on the right.

      

The Damper nodes avoid this with an even simpler structure:

Using the Damper nodes one can easily create such an animation without worrying what happens if the user clicks on the touch sensor in the wrong moment. The schema to do this is even simpler:


See the example Door-Dampered.wrl

When triggered by the TouchSensor the Script node sends either the SFRotation value for an opened or for a closed door to the Damper node. (that's all). The Damper then creates the animation from the current position to the position requested by the Script node. It takes into account the current direction and speed of movement, if any.


 

 

Case 2: Responding to User Input.

The Damper nodes allow to create animations by just giving the destination position. One does not need the skills to dynamically fill the keyValue array of an Interpolator node and to manage startTime and stopTime correctly.

Imagine an application where the user can place furniture inside a room by clicking on the walls, floor, etc. It can be done by associating a TouchSensor with each of the walls, floor and ceiling and with a Script node that generates the appropriate positions and orientations when a TouchSensor has been clicked.

 
The example
    Room-Direct.wrl
demonstrates this.

It's based on the node structure shown on the right.

    

In the above example the picture directly jumps to the new location.
By inserting a Damper node between the Script and the Transform the movement becomes animated.

 
See the example:
    Room-Dampered.wrl

That's all about creating animations with Dampers. To tweak the parameters for speed and smoothness, look at the Damper documentation.

Here is an alternative version that responds more quickly:
    Room-Dampered-Fast.wrl

 

Providing initial values

In the above examples the picture always starts being stuck in the ground. This comes because the Damper nodes begin with zeroes as their output values by default. To set another initial value, use the initial_output and initial_input fileds. One must set both fields to the same value, because otherwise this would create an animation from initial_output to initial_input.

See the example
    Room-Dampered-Initialized.wrl
containing  the parameters:
   initial_input  0 1.3 4
   initial_output 0 1.3 4

See the example
    Room-Dampered-InitialAnimation.wrl
containing  the parameters:
   initial_input  0  1.3 4
   initial_output 0 -1.3 4

 

 

Case 3: Smoothing existing animations.

While the above two cases used the Dampers for creating animations, this case uses them for refining existing animations. Thus, while only few animation keys need to be specified in the Interpolators, the resulting animation consist of smooth curves.

 
This example
    Coaster-Conventional.wrl
uses a conventional TimeSensor - Interpolator - Transform structure.

 
And the example
    Coaster-Dampered.wrl
inserts a Damper after the Interpolator.

Please note that in these two examples there are some Viewpoints defined for watching the coaster from different angles.


 

__.-.__
end of document