media @ VU
[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources _

talk show tell print

proto-matrix-sharedobject.vr

proto-matrix-sharedobject.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]


  PROTO SharedObject
  [
   exposedField    SFBool        isPilot            TRUE
   exposedField    SFString      name           ""
   exposedField    MFNode        children                  []
   exposedField    SFVec3f       position           0 0 0
   exposedField    SFRotation     orientation       0 0 1 0
   eventIn         SFBool        set_isVisible
   eventOut        SFBool        isVisible_changed
   exposedField    MFString       url               []
   exposedField    SFBool        isAvatar           FALSE
   exposedField    MFNode        states             []
  ]
  {
     Transform {
        translation IS position
        rotation IS orientation
        children [
           DEF Visible Switch {
              whichChoice 0
              choice [
                 Transform {
                    rotation 0 1 0 3.141592 # to compensate for Camera direction
                    children IS children
                 }
                ]
           }
           Group {
              children IS states
           }
           DEF Control Script {
              eventIn   SFBool   set_isVisible IS set_isVisible
              eventOut  SFBool   isVisible_changed IS isVisible_changed
              eventOut  SFInt32  choice
  
              mustEvaluate TRUE
  
              url "javascript:
        function set_isVisible( value ){
          isVisible_changed = value;
          if( value == true ){
            choice = 0;
          } else {
            choice = -1;
          }
        }"
           }
          ]
     }
     ROUTE Control.choice TO Visible.set_whichChoice
  }
  


(C) A. Eliëns 21/5/2007

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.