#VRML V2.0 utf8 WorldInfo { title "Floppy's VRML97 Tutorial Example 22" info ["(C) Copyright 1999 Vapour Technology" "vrmlguide@vapourtech.com"] } 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; } " } Transform { translation 0 -.5 8 children [ DEF SENSOR TouchSensor { } Shape { appearance Appearance { material Material { emissiveColor 1 0 0 } } geometry Sphere { radius 0.1 } } ] } 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 {} } ] } ROUTE SENSOR.touchTime TO CYCLE.touchTime ROUTE CYCLE.output TO SWITCH.whichChoice
© Copyright 1999 Vapour Technology - vrmlguide@vapourtech.com - http://www.vapourtech.com/vrmlguide