<
Viewpoint description='
Animation demo'
orientation='
1 0 1 -0.2'
position='
0 4 10'/>
<
Viewpoint centerOfRotation='
0 0.1 0'
description='
View from above'
orientation='
1 0 1 -1.57'
position='
0 20 0'/>
<!--
Pointer ROUTEs:
[
from PositionAnimator.value_changed to set_translation
]
[
from OrientationAnimator.value_changed to set_rotation
]
-->
<
Transform DEF='
Pointer'
translation='
1 0 1'>
<
Transform rotation='
1 0 0 1.57'>
<
Shape>
<
Cone bottomRadius='
0.5'
height='
1.5'/>
<
Appearance>
<
Material DEF='
ConeMaterial'
diffuseColor='
0.427451 1 0.160784'/>
</
Appearance>
</
Shape>
</
Transform>
</
Transform>
<
Shape DEF='
Floor'>
<
Box size='
10 0.05 10'/>
<
Appearance>
<Material diffuseColor='0 0.262745 0.941176'/>
</
Appearance>
</
Shape>
<!-- note that final value equals first value in keyValue array in order to support smooth looping -->
<!-- first drive around the location -->
<!--
PositionAnimator ROUTEs:
[
from AnimationClock.fraction_changed to set_fraction
]
[
from value_changed to Pointer.set_translation
]
-->
<
PositionInterpolator DEF='
PositionAnimator'
key='
0 0.2 0.25 0.45 0.5 0.7 0.75 0.95 1'
keyValue='
-4 0 -4 -4 0 4 -4 0 4 4 0 4 4 0 4 4 0 -4 4 0 -4 -4 0 -4 -4 0 -4'/>
<
ROUTE fromNode='
PositionAnimator'
fromField='
value_changed'
toNode='
Pointer'
toField='
set_translation'/>
<!-- then rotate the pointer to match next direction while paused at each position -->
<!--
OrientationAnimator ROUTEs:
[
from AnimationClock.fraction_changed to set_fraction
]
[
from value_changed to Pointer.set_rotation
]
-->
<
OrientationInterpolator DEF='
OrientationAnimator'
key='
0 0.2 0.25 0.45 0.5 0.7 0.75 0.95 1'
keyValue='
0 1 0 0 0 1 0 0 0 1 0 1.57 0 1 0 1.57 0 1 0 3.14 0 1 0 3.14 0 1 0 4.71 0 1 0 4.71 0 1 0 6.283'/>
<!-- final rotation value is 2pi rather than 0 so that rotation animation is smooth, not flip-flopping -->
<
ROUTE fromNode='
OrientationAnimator'
fromField='
value_changed'
toNode='
Pointer'
toField='
set_rotation'/>
<!-- put TimeSensor clock last so that animation design pattern and ROUTE events flow upward -->
<!--
AnimationClock ROUTEs:
[
from fraction_changed to PositionAnimator.set_fraction
]
[
from fraction_changed to OrientationAnimator.set_fraction
]
-->
<
TimeSensor DEF='
AnimationClock'
cycleInterval='
10'
loop='
true'/>
<
ROUTE fromNode='
AnimationClock'
fromField='
fraction_changed'
toNode='
PositionAnimator'
toField='
set_fraction'/>
<
ROUTE fromNode='
AnimationClock'
fromField='
fraction_changed'
toNode='
OrientationAnimator'
toField='
set_fraction'/>
<!-- notice that explanatory Text is placed later in scene although it is graphically located above driving plane -->
<
Transform translation='
0 3.5 0'>
<
Billboard axisOfRotation='
0 0 0'>
<
Shape>
<
Text string='
"Animation using PositionInterpolator" "and OrientationInterpolator"'
solid='
true'>
<FontStyle justify='"MIDDLE" "MIDDLE"' size='0.7'/>
</
Text>
</
Shape>
</
Billboard>
</
Transform>