#VRML V2.0 utf8
Viewpoint {}
NavigationInfo {
type "EXAMINE"
}
# 球
DEF Tf Transform {
translation -3 0 0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 1 1 0
}
}
geometry Sphere {}
}
DEF ThS TouchSensor {}
]
}
# スクリプト
DEF Sc Script {
eventIn SFTime touched
eventOut SFVec3f translation
field MFVec3f mv []
url "javascript:
function initialize () {
mv[0] = new SFVec3f (-3, 0, 0);
}
function touched () {
mv[0][0]++;
translation = mv[0];
}
"
}
ROUTE ThS.touchTime TO Sc.touched
ROUTE Sc.translation TO Tf.translation