#VRMLV2.0 utf8 ##:@* proto-matrix-sharedobject ##@ interface EXTERNPROTO SharedObject [ exposedField SFBool isPilot exposedField SFString name exposedField MFNode children exposedField SFVec3f position exposedField SFRotation orientation eventIn SFBool set_isVisible eventOut SFBool isVisible_changed exposedField MFString url exposedField SFBool isAvatar 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 } ##