#VRML V2.0 utf8 #
## ex-collision.wrl # Written By Leo # Last Modified Sept, 17 /97 # this example introduces the use collision detection # in order to start a color interpolation # the node TimeSensor is the animation clock and it is started by # the colliderTime event # (see at the end the ROUTE associations) # the user should aproximate his/her avatar to the sphere until # sphere and avatar collides. At that time the sphere (actually the # window) will begin to change its colors. The user should now move # going away from the sphere in order to see again the complet sphere # Camera Viewpoint { position 0 0 10 } DEF COL Collision { children [ DEF MOV_OBJ Transform { translation -8 0 -12 children [ Shape{ geometry Sphere { } appearance Appearance { material DEF MAT Material { diffuseColor 1 1 0 } } } ] } ] } # Timer DEF TIMER TimeSensor { startTime 0 stopTime 5 loop TRUE cycleInterval 7 } # Colours for the Cube DEF myColor ColorInterpolator { key [0.0, 0.3, 0.6, 1.0 ] keyValue [1 0 0 , 0 1 0, 1 0 0, 0 0 1] } #startTime to TIMER ROUTE COL.collideTime TO TIMER.startTime #run interpolators : myColor ROUTE TIMER.fraction_changed TO myColor.set_fraction #associate interpolator and color : ROUTE myColor.value_changed TO MAT.diffuseColor #