#VRML V2.0 utf8 ## ##@* editor ##@ scene NavigationInfo { type ["NONE"] } Viewpoint { description "Default View" position 0 0.5 2 } ##@ selector box Transform { translation -0.25 -0.15 0 children [ DEF CUBESENSOR TouchSensor { } ##: shape Shape { appearance Appearance { material Material { diffuseColor 1 0 0 } } geometry Box { size 0.1 0.1 0.17 } } ] } ## end ##@ selector sphere Transform { translation 0 -0.15 0 children [ DEF SPHERESENSOR TouchSensor { } ##: shape Shape { appearance Appearance { material Material { diffuseColor 0 1 0 } } geometry Sphere { radius 0.05 } } ] } ##@ selector cone Transform { translation 0.25 -0.15 0 children [ DEF CONESENSOR TouchSensor { } ##: shape Shape { appearance Appearance { material Material { diffuseColor 0 0 1 } } geometry Cone { bottomRadius 0.05 height 0.1 } } ] } ##@ (box) panel DEF TOP Transform { translation 0 0.5 0 children [ Transform { rotation 1 0 0 1.57 children [ Shape { appearance Appearance { material Material { diffuseColor 0.4 0.4 0.4 } } ##: panel geometry Box { size 1 1e-8 1 } } ] } ] } ## end TOP ##@ script DEF CREATOR Script { eventIn SFTime cube_touchTime eventIn SFTime sphere_touchTime eventIn SFTime cone_touchTime field SFNode parentNode USE TOP eventOut MFNode newChildren mustEvaluate TRUE url "javascript: //@ cube function function cube_touchTime(value,time) { newVRML = 'Group {'; newVRML += ' children ['; newVRML += ' DEF SENSOR PlaneSensor {'; newVRML += ' maxPosition 0.45 0.45'; newVRML += ' minPosition -0.45 -0.45'; newVRML += ' }'; //: function continued newVRML += ' DEF OBJECT Transform {'; newVRML += ' children ['; newVRML += ' Shape {'; newVRML += ' appearance Appearance {'; newVRML += ' material Material {'; newVRML += ' diffuseColor 1 0 0'; newVRML += ' }'; newVRML += ' }'; //: function continued newVRML += ' geometry Box {'; newVRML += ' size 0.1 0.1 0.1'; newVRML += ' }'; newVRML += ' }'; newVRML += ' ]'; newVRML += ' }'; newVRML += ' ]'; newVRML += '}'; newVRML += 'ROUTE SENSOR.translation_changed TO OBJECT.set_translation'; newChildren = Browser.createVrmlFromString(newVRML); } //@ sphere function function sphere_touchTime(value,time) { newVRML = 'Group {'; newVRML += ' children ['; newVRML += ' DEF SENSOR PlaneSensor {'; newVRML += ' maxPosition 0.45 0.45'; newVRML += ' minPosition -0.45 -0.45'; newVRML += ' }'; //: function continued newVRML += ' DEF OBJECT Transform {'; newVRML += ' children ['; newVRML += ' Shape {'; newVRML += ' appearance Appearance {'; newVRML += ' material Material {'; newVRML += ' diffuseColor 0 1 0'; newVRML += ' }'; newVRML += ' }'; //: function continued newVRML += ' geometry Sphere {'; newVRML += ' radius 0.05'; newVRML += ' }'; newVRML += ' }'; newVRML += ' ]'; newVRML += ' }'; newVRML += ' ]'; newVRML += '}'; newVRML += 'ROUTE SENSOR.translation_changed TO OBJECT.set_translation'; newChildren = Browser.createVrmlFromString(newVRML); } //@ cone function function cone_touchTime(value,time) { urlString = new MFString('@vr-web3d-cone.wrl'); Browser.createVrmlFromURL(urlString, parentNode, 'addChildren'); } " } ##@ event routing ROUTE CUBESENSOR.touchTime TO CREATOR.cube_touchTime ROUTE SPHERESENSOR.touchTime TO CREATOR.sphere_touchTime ROUTE CONESENSOR.touchTime TO CREATOR.cone_touchTime ROUTE CREATOR.newChildren TO TOP.addChildren ##