#VRML V2.0 utf8 ## ##@* switch cycling ##@ script DEF CYCLE Script { eventIn SFTime touchTime field SFInt32 number 4 eventOut SFInt32 output url "javascript: function initialize() { output = 0; } function touchTime(value, time) { if (output == number - 1) output = 0; else ++output; } " } ##@ button Transform { translation -7 5 0 children [ DEF SENSOR TouchSensor { } Shape { appearance Appearance { material Material { emissiveColor 1 0 0 } } geometry Sphere { radius 0.1 } } ] } ##@ switch DEF SWITCH Switch { whichChoice 0 choice [ Shape { appearance DEF BLUE Appearance { material Material { diffuseColor 0 0 1 } } geometry Box {} } Shape { appearance USE BLUE geometry Sphere {} } Shape { appearance USE BLUE geometry Cone {} } Shape { appearance USE BLUE geometry Cylinder {} } ] } ##@ event routing ROUTE SENSOR.touchTime TO CYCLE.touchTime ROUTE CYCLE.output TO SWITCH.whichChoice ##