#VRML V2.0 utf8 Viewpoint { position 0 0 20 description "Entry" } DEF TIMER TimeSensor { cycleInterval 2 loop TRUE startTime 1 } DEF TIMER2 TimeSensor { cycleInterval 4 loop TRUE startTime 1 } DEF ROTATOR OrientationInterpolator { key [ 0.0, 0.25, 0.5, 0.75, 1.0 ] keyValue [ 0 1 0 0, 0 1 0 1.510796327, 0 1 0 3.141592654, 0 1 0 4.71238898, 0 1 0 6.283185307 ] } DEF ROTATOR2 OrientationInterpolator { key [ 0.0, 0.25, 0.5, 0.75, 1.0 ] keyValue [ 0 1 0 0, 0 1 0 1.510796327, 0 1 0 3.141592654, 0 1 0 4.71238898, 0 1 0 6.283185307 ] } Transform { children [ Transform { translation 0 0 0 children [ # # A definition of the box sitting in the middle of the screen. # TimeSensor is also going to send a set_rotation event to this # box so that it can rotate with TimeSenor. # DEF MAINBOX Transform { translation 0 0 0 children [ Shape { appearance Appearance { material Material { diffuseColor .9 1.0 .5 } } geometry Box {} } ] } Transform { rotation 0 0 1 2.7 children [ # # A definition of a ball rotating around the main box. # DEF MOVINGBALL Transform { children [ Transform { translation 5 0 0 children [ Shape { appearance Appearance { material Material { diffuseColor .1 1.0 .5 } } geometry Sphere {} } ] } ] } ] } ] } ] } # Now we have one timer for each object on the scene. ROUTE TIMER.fraction_changed TO ROTATOR.set_fraction ROUTE TIMER2.fraction_changed TO ROTATOR2.set_fraction # OrientationInterplator maps the fraction to a suitable rotation angle # then feed this value to the set rotation event In of Transform node. # So that, ball rotates around the box. ROUTE ROTATOR2.value_changed TO MOVINGBALL.set_rotation # OrientationInterplator maps the fraction to a suitable rotation angle # then feed this value to the set rotation event In of Transform node. # so that box rotates. ROUTE ROTATOR.value_changed TO MAINBOX.set_rotation