#VRML V2.0 utf8 WorldInfo { title "DropSensor Test4" info [ "2000/12/17 by GoGoGo" "http://www1.plala.or.jp/Studio_GoGoGo/" ] } Viewpoint {position 0 13 14 orientation 1 0 0 -0.7 description "initial"} #オブジェ Transform {translation -5 0 0 children DEF IL0 Inline {}} Transform {translation 0 0 2 children DEF IL1 Inline {}} Transform {translation 5 0 0 children DEF IL2 Inline {}} #ホワイトボード DEF DS DropSensor {} Shape { appearance Appearance { material Material {emissiveColor 0.4 0.4 0.4} } geometry IndexedFaceSet { coord Coordinate {point [-10 0 6, 10 0 6, 10 0 -6, -10 0 -6]} coordIndex [0 1 2 3] } } #スクリプト #DropSensor からの url に「all」という文字列が含まれているか判別。 #含まれていたら、実際に必要な url を Inline ノードに送り込む。 #また、初回のみ有効になるようにしてある。 DEF SC Script { eventIn MFString URL eventOut MFString url0 eventOut MFString url1 eventOut MFString url2 field SFBool firstTime TRUE url "javascript: function URL(value) { if(value[0].search(/all/)!=-1) { if(firstTime) { url0[0]='sphere.wrl'; url1[0]='cone.wrl'; url2[0]='box.wrl'; firstTime=FALSE; } } }" } ROUTE DS.url TO SC.URL ROUTE SC.url0 TO IL0.url ROUTE SC.url1 TO IL1.url ROUTE SC.url2 TO IL2.url