#VRML V2.0 utf8 NavigationInfo { type "EXAMINE" } Viewpoint { position 0 10 10 orientation 1 0 0 -.8 } EXTERNPROTO AvoidConeChaser [ field SFVec3f position field SFVec3f goal field SFFloat speed field MFVec3f obstacles field SFInt32 index field SFFloat turnLimit field SFVec3f scale eventIn SFVec3f set_goal eventIn MFVec3f obstacles_changed eventOut MFFloat report_position ] "avoidConeChaser.wrl" EXTERNPROTO TouchFloor [ field SFVec3f scale field SFColor color ] "touchFloor.wrl" DEF TOUCH TouchFloor { scale 10 1 10 color .1 .1 .5 } DEF CHASER0 AvoidConeChaser { index 0 position 5 0 -3 speed 1.75 turnLimit .75 scale .1 .25 .75 } DEF CHASER1 AvoidConeChaser { index 1 position -5 0 -5 speed 1.25 turnLimit 1 scale .1 .25 .75 } DEF CHASER2 AvoidConeChaser { index 2 position -5 0 4 speed 1.5 turnLimit .75 scale .1 .25 .75 } DEF CHASER3 AvoidConeChaser { index 3 position -3 0 4 speed 1 turnLimit 1 scale .1 .25 .75 } DEF CHASER4 AvoidConeChaser { index 4 position 3 0 1 speed 2 turnLimit .5 scale .1 .25 .75 } DEF SCRIPT Script { eventIn SFTime beat eventIn MFFloat update_position eventOut MFVec3f chasers_moved field MFVec3f chaserPositions [ ] field SFInt32 numChasers 5 url "vrmlscript: function initialize() { chaserPositions = new MFVec3f(); } function update_position(val) { i = val[0]; x = val[1]; y = val[2]; z = val[3]; chaserPositions[i] = new SFVec3f(x, y, z); } function beat(val) { chasers_moved = chaserPositions; } " } DEF SIMCLOCK TimeSensor { loop TRUE } ROUTE CHASER0.report_position TO SCRIPT.update_position ROUTE CHASER1.report_position TO SCRIPT.update_position ROUTE CHASER2.report_position TO SCRIPT.update_position ROUTE CHASER3.report_position TO SCRIPT.update_position ROUTE CHASER4.report_position TO SCRIPT.update_position ROUTE SIMCLOCK.time TO SCRIPT.beat ROUTE SCRIPT.chasers_moved TO CHASER0.obstacles_changed ROUTE SCRIPT.chasers_moved TO CHASER1.obstacles_changed ROUTE SCRIPT.chasers_moved TO CHASER2.obstacles_changed ROUTE SCRIPT.chasers_moved TO CHASER3.obstacles_changed ROUTE SCRIPT.chasers_moved TO CHASER4.obstacles_changed
mrl