#VRML V2.0 utf8 Transform { children [ DEF TS TouchSensor {} # TouchSensor Shape { appearance Appearance { material DEF SphereColor Material { diffuseColor 1 0 0 } # red } geometry Sphere {} } ] } DEF ColorScript Script { url "ChangeColor.class" eventIn SFBool clicked eventOut SFColor newColor field SFBool on FALSE } # Routing ROUTE TS.isActive TO ColorScript.clicked ROUTE ColorScript.newColor TO SphereColor.set_diffuseColor