Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Created June 6, 2013 10:03
Show Gist options
  • Save cecilemuller/5720511 to your computer and use it in GitHub Desktop.
Save cecilemuller/5720511 to your computer and use it in GitHub Desktop.
X3D: Multiple touchsensors
#X3D V3.0 utf8
PROFILE Immersive
Viewpoint {}
Transform {
translation -2 0 0
children [
DEF touchsensor_1 TouchSensor {}
Shape {
appearance Appearance {
material Material {}
}
geometry Box{}
}
]
}
Transform {
translation 2 0 0
children [
DEF touchsensor_2 TouchSensor {}
Shape {
appearance Appearance {
material Material {}
}
geometry Sphere{}
}
]
}
DEF a_script Script {
eventIn SFTime obj_1_clicked
eventIn SFTime obj_2_clicked
directOutput TRUE
url "javascript:
function obj_1_clicked(){
trace('The Box was clicked');
}
function obj_2_clicked(){
trace('The Sphere was clicked');
}
"
}
ROUTE touchsensor_1.touchTime TO a_script.obj_1_clicked
ROUTE touchsensor_2.touchTime TO a_script.obj_2_clicked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment