media @ VU
proto-rif-interface-wheel.vr
proto-rif-interface-wheel.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
wheel
Web3D/VR
#@extern @vr-extern-proto-object-box.wrl
PROTO Wheel [
exposedField SFVec3f scale 1 1 1
field SFVec2f position 0 0
field SFVec2f size 1 1
exposedField MFString texture [ "wheel.gif" ]
exposedField SFFloat value 0
] {
DEF TRANS Transform {
scale IS scale
children [
DEF ROTATESENSOR PlaneSensor {
enabled TRUE
minPosition 0 -0.314
maxPosition 0 0
}
DEF ROTATETRANS Transform {
children Shape {
appearance Appearance {
texture DEF TEXTURE ImageTexture { url IS texture }
}
geometry DEF WINDOWBOX box { }
}
}
]
}
DEF SCRIPT Script {
directOutput TRUE
eventIn SFTime touchTime
field SFNode transformNode USE TRANS
field SFNode rotateTrans USE ROTATETRANS
field SFVec2f position IS position
field SFVec2f size IS size
eventIn SFVec3f setRotateTrans
eventOut SFRotation rotation_changed
eventOut SFVec3f set_size
eventIn SFFloat set_value IS value
field SFFloat value IS value
eventOut SFFloat value_changed IS value
url "vrmlscript:
function initialize() {
transformNode.translation =
new SFVec3f(position.x,position.y,0);
set_size = new SFVec3f(size.x,size.y,0.02);
rotation_changed = new SFRotation(0,0,1, value*-3.14);
value_changed = value;
}
function setRotateTrans (value,time) {
rotation_changed = new SFRotation(0,0,1, value.y*10);
value_changed = (value.y/-0.314);
//Browser.print('value : ' + (value.y/-0.314));
}
"
}
ROUTE SCRIPT.set_size TO WINDOWBOX.size
ROUTE ROTATESENSOR.translation_changed TO SCRIPT.setRotateTrans
ROUTE SCRIPT.rotation_changed TO ROTATETRANS.rotation
}
(C) A. Eliëns
21/5/2007
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.