#VRML V2.0 utf8
Viewpoint {}
NavigationInfo {
type "EXAMINE"
}
Group {
children [
Shape {
appearance Appearance {
material DEF Ball-Mt Material {
diffuseColor 1 0 0
}
}
geometry Sphere {}
}
DEF ThS TouchSensor {}
]
}
DEF Sc Script {
eventIn SFTime colorChange
field SFNode BallMt USE Ball-Mt
directOutput TRUE
url "javascript:
function colorChange () {
var r = Math.random();
var g = Math.random();
var b = Math.random();
BallMt.diffuseColor = new SFColor (r,g,b);
}
"
}
ROUTE ThS.touchTime TO Sc.colorChange