important lesson number one:
you can't map an exposedField of a PROTO to a Script nodes field
the fields in a Script node are fields NOT exposedFields, so you will have
to create your own eventIn and Out to set and get the values, soemthing like
PROTO VBox
[
eventOut SFVec3f position_changed
eventIn SFVec3f set_position
field SFVec3f position 0 0 0
]
{
DEF Tr Transform
{
translation IS position
Shape
{
geometry Box {}
}
}
DEF script1 Script
{
eventOut SFVec3f set_location
eventIn SFVec3f set_position IS set_position
eventOut SFVec3f position_changed IS position_changed
field SFVec3f pos IS position
url "javascript:
function set_position(sfvec3f,tm){
pos = sfvec3f
position_changed = pos
set_location = pos
}
"
}
Quote:
}
ROUTE set_location TO tr.set_translation
note that the new eventIn and Out have been defined, and linked to the
script, and then the script has a 3rd event, which is ROUTEd to the
transform to change its translation.
db