#VRML V2.0 utf8 # The Collection of Protos for DeepMatrixIP9 Multi-user system. # As long as you leave the original eventIns, eventOuts and exposedFields alone # you can add your own and modify the scripts as needed! Always remember to test your # work! Never assume anything! # See the code of "Matrix","BlackSun","Chess","Desert Treasure Hunt" and "Seven Emerald Tablets"! # Walker - MANDATORY! It replaces the ProximitySensor, default NavigationalInfo, and default Viewpoint Nodes. # It does all the controlling of the user's avatar. Does the 'Beam-to' and 'Ghost' work. # Provides governing of the output of the user's position and orientation so the two networks # local and global are not flooded with values. # Provides the default NavigationalInfo and Viewpoint Nodes! # Provides the BeamTo and Ghost features! # Provides a HUD capability. # It can be modified to suit needs - but remember to test the modifications! PROTO Walker [ # set_navigation - values set by Java EAI and also internally by the Proto's scripts. eventIn SFInt32 set_navigation # set_Wakeup - is called by the Java EAI during loading # It runs a short animated viewpoint to make sure the ProximitySensor sends the correct values to the network and user! eventIn SFBool set_Wakeup # setBeamTo - is called by the Java EAI to deliver the position and orientation of the target user or object for beam to. eventIn MFFloat setBeamTo # set_bind - binds the Ghost viewpoint for viewing user's avatar eventIn SFBool set_bind # navCycleTime - a time stamp given when NavigationInfo type has been changed. eventOut SFTime navCycleTime # primer_time - time stamp given during initial loading. eventOut SFTime primer_time # ghostBindTime - ghostIsBound - outputs from the Ghost Viewpoint -bound when a user views their avatar. eventOut SFTime ghostBindTime eventOut SFBool ghostIsBound # beamBindTime - beamIsBound - outputs from the Beamto Viewpoint -bound when beaming to an object or person. eventOut SFTime beamBindTime eventOut SFBool beamIsBound # ProximitySensor fields size -be sure to change the 0s to values when it is instanced! # Just treat the Walker Proto instance as a ProximitySensor! exposedField SFVec3f size 0 0 0 exposedField SFBool enabled TRUE exposedField SFVec3f center 0 0 0 eventOut SFTime enterTime eventOut SFTime exitTime eventOut SFBool isActive # orientation_changed and position_changed are observered by the Java EAI # Values change by the cycleInterval field below. eventOut SFRotation orientation_changed eventOut SFVec3f position_changed # rotation_changed and translation_changed are for continuous output from the ProximitySensor for Scripts and HUDs eventOut SFRotation rotation_changed eventOut SFVec3f translation_changed # cycleInterval governs the output from the ProximitySensor exposedField SFTime cycleInterval .4 # for modifying the user's position and orientation when necessary eventIn SFVec3f set_viewpoint_position eventIn SFRotation set_viewpoint_orientation exposedField SFString protoName "Walker" # NavigationInfo stuff Just treat the Walker Proto as a NavigationInfo Node with these! exposedField SFFloat set_speed 3 # type - this field is observered the Java EAI for changes. exposedField MFString type [ "WALK" "ANY" ] exposedField MFFloat avatarSize [ .25 1.6 .75 ] exposedField SFBool headlight TRUE exposedField SFFloat visibilityLimit 0 # isBound - boolean output for when the NavigationInfo Node is bound. eventOut SFBool isBound # set_navbind - is called by the Java EAI to bind the NavigationInfo during the user's initial entry. eventIn SFBool set_navbind # The default on entry viewpoint fields for the world. Just treat the Walker Proto as a Viewpoint Node with these! exposedField SFBool jump TRUE exposedField SFString description "Entry" exposedField SFRotation vporientation 0 1 0 0 exposedField SFVec3f vpposition 0 0 0 exposedField SFFloat fieldOfView .785 # isVpBound - Entry viewpoint bind state eventOut SFBool isVpBound # bindTime - Entry viewpoint bind time eventOut SFTime bindTime # bAnimVp - set to FALSE is a work-around for some worlds that require a short animated Viewpoint # on the user's initial entry to register the user's position and orientation with the Java EAI observers. field SFBool bAnimVp FALSE # vpbind - not only binds the entry Viewpoint but sets up a the small animation for it. eventIn SFBool vpbind # setVpbind2 - just only binds the Entry Viewpoint and does nothing else. eventIn SFBool setVpbind2 # bAnim - set to TRUE is a work-around for some worlds that require a short animated Viewpoint # to register the user's position and orientation with the Java EAI observers when the Entry viewpoint is bound TRUE # either by selection from the client's GUI or by a Script. It's setting as TRUE has to be determined by builder by testing. # See the MatrixViewpoint2 Proto as well. field SFBool bAnim FALSE # navigation_info_changed observed by Java EAI for both speed and changes in headlight and collision. eventOut SFFloat navigation_info_changed # changes world Collision exposedField SFBool collide TRUE # masterCollide duplicates the "WALKRESTRICTED" type of blaxxun navigation. # when TRUE collision cannot be turned off! # A world builder must set the type field above to collision only navigation types like "WALK","FLY" and "LOOKAT"! exposedField SFBool masterCollide FALSE # collision_state is meant to be read by scripts to determine initial collision state of the world on load. eventOut SFBool collision_state # bInitCollide IS the initial collision state desired by the builder! # It is sent to the above collision_state eventOut during initial loading, # Default setting is TRUE. field SFBool bInitCollide TRUE ] { Group { children [ DEF WalkNav NavigationInfo { avatarSize IS avatarSize headlight IS headlight speed IS set_speed type IS type visibilityLimit IS visibilityLimit set_bind IS set_navbind isBound IS isBound } DEF Col Collision { collide IS collide } DEF MCol Collision { collide IS masterCollide } DEF Tms TimeSensor { cycleInterval IS cycleInterval } DEF Bb ProximitySensor { center IS center enabled IS enabled size IS size enterTime IS enterTime exitTime IS exitTime isActive IS isActive } DEF EntryVp Viewpoint { fieldOfView IS fieldOfView jump IS jump orientation IS vporientation position IS vpposition #set_bind IS vpbind bindTime IS bindTime isBound IS isVpBound } DEF GhostVp Viewpoint { bindTime IS ghostBindTime isBound IS ghostIsBound } DEF BeamVp Viewpoint { bindTime IS beamBindTime isBound IS beamIsBound } DEF BufferTms TimeSensor { loop TRUE } DEF NavTms TimeSensor { cycleTime IS navCycleTime } DEF WakeupTms TimeSensor { cycleInterval .8 } DEF WakeupOI OrientationInterpolator { key [ 0 .5 1 ] } DEF WakeupPI PositionInterpolator { key [ 0 .5 1 ] } DEF Sc Script { eventIn SFFloat speedUpdate eventIn SFBool set_headlightState eventIn SFBool set_collisionState eventIn SFBool set_masterCollisionState eventIn SFBool setVpbind2 IS setVpbind2 eventIn SFBool setVpbind IS vpbind eventIn SFBool reset_bool eventIn SFBool set_bufferActive eventIn SFBool set_Wakeup IS set_Wakeup eventIn SFTime set_enterTime eventIn SFBool set_navbind IS set_navbind eventIn SFInt32 set_navigation IS set_navigation eventIn MFFloat setBeamTo IS setBeamTo eventIn SFBool set_active2 eventIn SFBool set_bind IS set_bind eventIn SFBool set_active3 eventIn SFBool set_bool eventIn SFBool set_bool2 eventIn SFVec3f set_viewpoint_position IS set_viewpoint_position eventIn SFRotation set_viewpoint_orientation IS set_viewpoint_orientation eventIn SFRotation set_rotation eventIn SFVec3f set_vec3f eventOut SFBool collision_state IS collision_state eventOut SFTime primer_time IS primer_time eventOut SFVec3f translation_changed IS translation_changed eventOut SFRotation rotation_changed IS rotation_changed eventOut SFVec3f position_changed IS position_changed eventOut MFNode nodes_changed eventOut SFString message_changed eventOut SFFloat navigation_info_changed IS navigation_info_changed eventOut SFRotation orientation_changed IS orientation_changed directOutput TRUE field SFString sName "" field SFBool bAnim IS bAnim field SFBool bAvalon FALSE field SFBool bAnimVp IS bAnimVp field SFNode MCol USE MCol field SFNode BufferTms USE BufferTms field SFNode WakeupOI USE WakeupOI field SFNode WakeupPI USE WakeupPI field SFNode WakeupTms USE WakeupTms field SFNode EntryVp USE EntryVp field SFNode WalkNav USE WalkNav field SFNode NavTms USE NavTms field SFNode GhostVp USE GhostVp field SFNode BeamVp USE BeamVp field SFNode Tms USE Tms field SFNode Bb USE Bb field SFNode Sc USE Sc field SFInt32 posct 0 field SFInt32 iHL 0 field SFInt32 iCL 0 field SFInt32 iMC 0 field SFBool bInitCollide IS bInitCollide field SFRotation rot 0 0 1 0 field SFRotation rot2 0 0 1 0 field SFRotation rot3 0 0 1 0 field SFRotation rot4 0 1 0 3.14 field SFRotation rot5 0 1 0 0 field SFVec3f pos 0 0 0 field SFVec3f pos2 0 0 0 field SFVec3f pos3 0 0 4 field SFVec3f posHUD 0 0 -4 field SFVec3f pos4 0 0 -5 field SFVec3f pos5 0 0 0 field MFString OrigNav [] field SFBool bGhostHUD FALSE field SFBool Bstate FALSE field SFBool Tstate FALSE field SFVec3f Halfway_pos 0 0 0 field SFRotation Halfway_rot 0 1 0 0 field SFBool Pstate FALSE field SFBool Rstate FALSE field SFString Navchange "" field MFString preNav [] field MFString navtypes [] url "javascript: function speedUpdate(v){ navigation_info_changed = v; } function set_masterCollisionState(v){ if(!v){ navigation_info_changed = -6.0; set_navigation(13); } else { navigation_info_changed = -5.0; set_navigation(12); } } function set_headlightState(v){ if(!v){ navigation_info_changed = -2.0; iHL = 9; } else { navigation_info_changed = -1.0; iHL = 8; } } function set_collisionState(v){ if(!MCol.collide){ if(!v){ navigation_info_changed = -4.0; set_navigation(11); } else { navigation_info_changed = -3.0; set_navigation(10); } } } function set_viewpoint_position(v){ position_changed = v; translation_changed = v; } function set_viewpoint_orientation(v){ orientation_changed = v; rotation_changed = v; } function setVpbind2(v){ if(v){ EntryVp.set_bind = true; }} function setVpbind(v){ if(v){ collision_state = bInitCollide; EntryVp.set_bind = true; EntryVp.position = WakeupPI.keyValue[2]; EntryVp.orientation = WakeupOI.keyValue[2]; EntryVp.set_bind = v; if(OrigNav[0]!='NONE'){ WalkNav.type = OrigNav; } if(bAnim){ WakeupTms.startTime = ts; } } } function set_bufferActive(v,ts){ if(v){ EntryVp.set_bind = true; if(!bAnimVp){ set_Wakeup(v,ts);} primer_time = ts; BufferTms.loop = false;} } function set_Wakeup(v,ts){ sName = Browser.getName(); if(sName=='Avalon'&&WalkNav!=null){ bAvalon = true; Browser.addRoute(Sc,'nodes_changed',WalkNav,'navigator'); nodes_changed = Browser.createVrmlFromString('SpaceNavigator {}'); Browser.addRoute(Sc,'message_changed',Sc.nodes_changed[0],'message'); } WakeupPI.keyValue[0] = EntryVp.position; Halfway_pos = EntryVp.position; Halfway_pos[1] += .3; WakeupPI.keyValue[1] = Halfway_pos; WakeupPI.keyValue[2] = EntryVp.position; WakeupOI.keyValue[0] = EntryVp.orientation ; OrigNav = WalkNav.type; Halfway_rot = EntryVp.orientation; Halfway_rot[3] += .1; WakeupOI.keyValue[1] = Halfway_rot; WakeupOI.keyValue[2] = EntryVp.orientation; WakeupTms.startTime = ts; } function set_navigation(v,ts){ if(v<7){ if(v==0){ Navchange = 'EXAMINE'; } if(v==1){ Navchange = 'WALK'; } if(v==2){ Navchange = 'FLY'; } if(v==3){ Navchange = 'FREEFLY'; } if(v==4){ Navchange = 'LOOKAT'; } if(v==5){ Navchange = 'PAN'; } if(v==6){ Navchange = 'SLIDE'; } navtypes = new MFString(Navchange); var iCt = 1; for( var a = 0; a=rate){ if(6.28=rate){ new_pos = new SFVec3f(ft[0],ft[1],ft[2]); var vm = new VrmlMatrix(); vm.setTransform(new_pos,default_rot); var vm2 = new VrmlMatrix(); vm2.setTransform(cur_pos,position_rot); vm = vm.multRight(vm2); vm.getTransform(cur_pos); position_changed = cur_pos; old_flt = new_flt; new_flt = 0.0; resetft(); tms = ts; } } function set_Yon(v){ xyz[3] = xyz[0] = Tmss[1].whichChoice = 0; new_rot[3] = 0.0; } function set_Yoff(v){ xyz[2] = xyz[1] = Tmss[3].whichChoice = Tmss[2].whichChoice = 0; xyz[3] = xyz[0] = Tmss[1].whichChoice = 1; new_rot = new SFRotation( 0, 1, 0, 0.0); } function set_Xon(v){ xyz[3] = xyz[1] = Tmss[2].whichChoice = 0; new_rot[3] = 0.0; } function set_Xoff(v){ xyz[2] = xyz[0] = Tmss[3].whichChoice = Tmss[1].whichChoice = 0; xyz[3] = xyz[1] = Tmss[2].whichChoice = 1; new_rot = new SFRotation( 1, 0, 0, 0.0); } function set_Zon(v){ xyz[3] = xyz[2] = Tmss[3].whichChoice = 0; new_rot[3] = 0.0; } function set_Zoff(v){xyz[1] = xyz[0] = Tmss[1].whichChoice = Tmss[2].whichChoice = 0; xyz[3] = xyz[2] = Tmss[3].whichChoice = 1; new_rot = new SFRotation( 0, 0, 1, 0.0); Angle2 = 0.0;} function set_active1 (v, ts) { if(v){ resetft(); ch = 0; } Tmss[0].enabled = v; } function set_active2 (v, ts) { if(v){ resetft(); ch = 1; } Tmss[0].enabled = v; } function set_active3 (v, ts) { if(v){ resetft(); pvch = ch; //newDirection(); ch = 2; } Tmss[0].enabled = v; } function set_active4 (v, ts) { if(v){ resetft(); ch = 3; } Tmss[0].enabled = v; } function set_active5 (v, ts) { if(v){ resetft(); ch = 4; } Tmss[0].enabled = v; } function set_active6 (v, ts) { if(v){ resetft(); ch = 5; } Tmss[0].enabled = v; } " directOutput TRUE field MFNode Tmss [ USE Tms1 USE Y_sw USE X_sw USE Z_sw ] field SFVec3f start_pos 0 0 0 field SFVec3f orig_pos 0 0 0 field SFVec3f new_pos 0 0 0 field SFVec3f cur_pos 0 0 0 field SFVec3f pos5 0 0 0 field SFVec3f pos4 0 0 -10 field SFInt32 ch 0 field SFInt32 num 0 field SFInt32 pvch -1 field SFFloat new_flt 0 field SFFloat old_flt 0 field SFRotation default_rot 0 1 0 0 field SFRotation new_rot 0 1 0 0 field SFRotation start_rot 0 1 0 0 field SFRotation position_rot 0 1 0 0 field SFRotation cur_rot 0 1 0 0 field SFRotation prev_rot 0 1 0 0 field SFRotation orig_rot 0 1 0 0 field SFRotation reset_rot 0 1 0 0 field SFRotation rot5 0 1 0 0 field SFRotation rot4 0 1 0 3.14 field SFFloat Angle 0 field SFFloat Angle2 0 field SFTime tms 0 field SFTime rate IS rate field MFInt32 xyz [ 0 0 0 0 ] field MFFloat ft [ 0 0 0 ] field SFVec3f mv 0 0 0 } ] } whichChoice IS whichChoice } ROUTE Sphs.rotation_changed TO SphsTr.set_rotation ROUTE Yonts.isOver TO Movesc.set_OverYon ROUTE Yoffts.isOver TO Movesc.set_OverYoff ROUTE Xonts.isOver TO Movesc.set_OverXon ROUTE Xoffts.isOver TO Movesc.set_OverXoff ROUTE Zonts.isOver TO Movesc.set_OverZon ROUTE Zoffts.isOver TO Movesc.set_OverZoff ROUTE ReturnPosTs.isOver TO Movesc.set_returnOverPos ROUTE AddrotTs.isOver TO Movesc.add_Overrotation ROUTE SubrotTs.isOver TO Movesc.sub_Overrotation ROUTE Fix.isOver TO Movesc.set_Overcheck ROUTE ReturnTs.isOver TO Movesc.set_OverreturnRot ROUTE ResetTs.isOver TO Movesc.set_OverresetRot ROUTE U_ts.isOver TO Movesc.set_over1 ROUTE D_ts.isOver TO Movesc.set_over2 ROUTE R_ts.isOver TO Movesc.set_over3 ROUTE L_ts.isOver TO Movesc.set_over4 ROUTE F_ts.isOver TO Movesc.set_over5 ROUTE B_ts.isOver TO Movesc.set_over6 ROUTE ReturnPosTs.touchTime TO Movesc.set_returnPos ROUTE AddrotTs.touchTime TO Movesc.add_rotation ROUTE SubrotTs.touchTime TO Movesc.sub_rotation ROUTE Fix.touchTime TO Movesc.set_check ROUTE ReturnTs.touchTime TO Movesc.set_returnRot ROUTE ResetTs.touchTime TO Movesc.set_resetRot ROUTE SphsTr.rotation_changed TO Movesc.set_rotation ROUTE Yonts.touchTime TO Movesc.set_Yon ROUTE Yoffts.touchTime TO Movesc.set_Yoff ROUTE Xonts.touchTime TO Movesc.set_Xon ROUTE Xoffts.touchTime TO Movesc.set_Xoff ROUTE Zonts.touchTime TO Movesc.set_Zon ROUTE Zoffts.touchTime TO Movesc.set_Zoff ROUTE U_ts.isActive TO Movesc.set_active1 ROUTE D_ts.isActive TO Movesc.set_active2 ROUTE R_ts.isActive TO Movesc.set_active3 ROUTE L_ts.isActive TO Movesc.set_active4 ROUTE F_ts.isActive TO Movesc.set_active5 ROUTE B_ts.isActive TO Movesc.set_active6 ROUTE Tms1.fraction_changed TO Movesc.set_float1 ROUTE Movesc.offset_changed TO Sphs.set_offset } Walker { size 10000 10000 10000 }