#VRML V2.0 utf8
Viewpoint {}
NavigationInfo {
type "EXAMINE"
}
# 頭
DEF Head-Tf Transform {
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 1.0 0.6 0.2
}
}
geometry Cylinder {}
}
Transform {
translation -0.35 0 1
rotation 1 0 0 1.5708
children [
DEF EYE-Sp Shape {
appearance Appearance {
material Material {
diffuseColor 0 1 0.5
}
}
geometry Cylinder {
radius 0.2
height 0.1
}
}
]
}
Transform {
translation 0.35 0 1
rotation 1 0 0 1.5708
children USE EYE-Sp
}
DEF ThS TouchSensor {}
]
}
#タイムセンサー
DEF TiS TimeSensor {
cycleInterval 3
}
#回転アニメ
DEF OI OrientationInterpolator {
key [ 0.0 0.5 1.0 ]
}
ROUTE ThS.touchTime TO TiS.startTime
ROUTE TiS.fraction_changed TO OI.set_fraction
ROUTE OI.value_changed TO Head-Tf.rotation
# スクリプト
DEF Sc Script {
eventOut MFRotation keyValue
field SFRotation rx 1 0 0 1.5708 # X軸を中心に90度回転
field SFRotation ry 0 1 0 1.5708 # Y軸を中心に90度回転
url "javascript:
function initialize () {
keyValue[0] = new SFRotation ();
keyValue[1] = ry;
keyValue[2] = ry.multiply(rx);
}
"
}
ROUTE Sc.keyValue TO OI.keyValue