### the line above this one says #switch ### Appendix A Step 15 ### DEF random_clock TimeSensor{cycleInterval 8 } ### End of step 15 ### ### Appendix A Step 6. DEF wa_script Script { eventIn SFVec3f set_position IS set_position eventIn SFBool set_watched eventIn SFBool stop_walk field SFNode walk USE TS9 field SFNode stop USE TS10 field SFBool watched FALSE field SFVec3f dest 0 0 0 exposedField SFBool isStop TRUE field SFInt32 stopp 0 field SFNode gest USE Welder directOutput TRUE ### Added next 3 lines Appendix A step 16 ### field SFTime lastTime 0 eventIn SFBool set_active eventOut SFTime randomTime_changed ### End of step 16 ### url "vrmlscript: // added Idle Gesture function Step 17 // function set_active(v,t){ if(v){return;} if(!watched || !isStop){randomTime_changed = t; return;} rnd = Math.random() * 100; if(rnd <25){randomTime_changed = t; return;} if(rnd >=25 && rnd < 35){gest.G0 = t;} // she does gesture 0,1,&2 on a random basis if(rnd >=35 && rnd < 45){gest.G1 = t;} if(rnd >=45 && rnd < 55){gest.G2 = t;} if(rnd >=55 && rnd < 65){gest.G0 = t;} if(rnd >=65 && rnd < 80){gest.G1 = t;} if(rnd >=90){gest.G2 = t;} randomTime_changed = t; } function initialize(){ randomTime_changed = Browser.getTime(); } // End of step 17 // function set_watched(v,t){watched = v;} function set_position(v, t) { if(dest[0] != v[0] || dest[1] != v[1] || dest[2] != v[2]) { isStop = false; stopp = 0; if(stop.isActive){stop.stopTime = t;} if(!walk.enabled && watched) { walk.enabled = true; gest.G8 = t; } dest = v; } } function stop_walk(b, t) { if(!b) { if(walk.enabled) { walk.enabled = false; walk.stopTime = t; } if(stopp < 1) { stop.startTime = t; isStop = true; stopp++; } return; } }"} ### End of step 6 ### ### Appendix A Step 8 ### ROUTE TimeStop.isActive TO wa_script.stop_walk ROUTE vis.isActive TO wa_script.set_watched ### End of Step 8 ### ### Idle gesture Step 19 ROUTE wa_script.randomTime_changed TO random_clock.set_startTime ROUTE random_clock.isActive TO wa_script.set_active ### End of Step 19 ### ### The rest of the Routes are below this line ###