#VRML V2.0 utf8 # Par antoine PASQUAY, le 09/04/2003 Transform { children [ DEF capteur TouchSensor {} Shape { geometry Box { } appearance Appearance { material DEF mat Material { diffuseColor 1 0 0 } } } ] } DEF change Script { eventIn SFTime touch field SFBool etat FALSE field SFNode mat USE mat url "javascript: function touch(){ etat = !etat ; if (etat){ mat.diffuseColor [0] = 0 ; mat.diffuseColor [1] = 1 ; } else { mat.diffuseColor [0] = 1 ; mat.diffuseColor [1] = 0 ; } }" } ROUTE capteur.touchTime TO change.touch