| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| i don't seem to be able to instanciate a proto in a script, i think it really should work but, Cortona says 'unrecognised node' and Contact says nothing but the result is NULL, can anyone see whats wrong or is it browser problems. BTW im trying to have a script place some objects into a world, the script has the logic of how to arrange them but doesn't know what, or how many, objects are being added. example; ( replacing 'myproto{}' with the text inside the proto definition causes this to work) #VRML V2.0 utf8 PROTO myproto []{ Shape {geometry Box {}} } DEF scrpt Script { eventOut MFNode out url [ "javascript: function initialize(){ out=new MFNode(new SFNode('myproto{}')); }" ] } DEF trans Transform {} ROUTE scrpt.out TO trans.addChildren |
|
#2
| |||
| |||
| On Jun 9, 6:15*pm, simon <simon.pl...@googlemail.com> wrote: > i don't seem to be able to instanciate a proto in a script, i think it > really should work but, Cortona says 'unrecognised node' and Contact > says nothing but the result is NULL, can anyone see whats wrong or is > it browser problems. > > BTW im trying to have a script place some objects into a world, the > script has the logic of how to arrange them but doesn't know what, or > how many, objects are being added. > > example; > ( replacing 'myproto{}' with the text inside the proto definition > causes this to work) > > #VRML V2.0 utf8 > PROTO myproto []{ > * * * * * * *Shape {geometry * *Box * * {}} > > } > > DEF scrpt Script { > * * * * eventOut MFNode out > * * * * url [ *"javascript: > * * * * * * * * function initialize(){ > * * * * * * * * * * * *out=new MFNode(new SFNode('myproto{}')); > * * * * * * * * }" > * * * * *] > > } > > DEF * * trans Transform {} > ROUTE scrpt.out TO trans.addChildren That works: #VRML V2.0 utf8 DEF scrpt Script { eventOut MFNode out url [ "javascript: function initialize(){ out=Browser.createVrmlFromString('PROTO myproto []{Shape {geometry Box{}}} myproto{}'); }" ] } DEF trans Transform {} ROUTE scrpt.out TO trans.addChildren |
|
#3
| |||
| |||
| > > BTW im trying to have a script place some objects into a world, the > > script has the logic of how to arrange them but doesn't know what, or > > how many, objects are being added. so the node can't be defined in the script. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.