1#X3D V3.0 utf8 2PROFILE Immersive 3 4Transform 5 { 6 children 7 [ 8 Shape 9 { 10 appearance Appearance 11 { 12 material Material 13 { 14 } 15 } 16 geometry Sphere 17 { 18 } 19 } 20 DEF TouchSensor3 TouchSensor 21 { 22 } 23 ] 24 } 25 26DEF Script1 Script 27 { 28 inputOnly SFBool bool1_in 29 outputOnly MFString mstring1_out 30 url 31 [ 32 "ecmascript: 33 34 // eventOut MFString mstring1_out // 35 function bool1_in(value) 36 { 37 // value SFBool 38 if (value) 39 { 40 mstring1_out = new MFString('pressed'); 41 } 42 else 43 { 44 mstring1_out = new MFString('released'); 45 } 46 } 47 48" 49 "java: 50 X3dScript_Script1 script = (X3dScript_Script1)node; 51 script.mstring1_out = new String[1]; 52 script.mstring1_out[0] = \"\"; 53 if (script.bool1_in) 54 script.mstring1_out[0] = \"pressed\"; 55 else 56 script.mstring1_out[0] = \"released\"; 57" 58 ] 59 } 60 61ROUTE TouchSensor3.isActive TO Script1.bool1_in 62 63Transform 64 { 65 translation -2.96995329 -2.26498842 0 66 children 67 Shape 68 { 69 appearance Appearance 70 { 71 material Material 72 { 73 } 74 } 75 geometry DEF Text1 Text 76 { 77 string "click sphere" 78 } 79 } 80 } 81 82ROUTE Script1.mstring1_out TO Text1.set_string 83 84