this file does not work as expected in Cortona 5.1 b167.
#VRML V2.0 utf8
Shape { geometry Box {}}
DEF PS1 PlaneSensor {}
DEF T1 TimeSensor { loop TRUE enabled TRUE }
DEF Program Script {
mustEvaluate TRUE directOutput TRUE
field SFNode ps1 USE PS1
eventIn SFTime checkSensor
exposedField SFBool isActive FALSE #default
eventIn SFBool isActive2
url "javascript:
function checkSensor ( t ) {
// print ( ps1.isActive ); // direct access to PlaneSensor provides proper values
print ( isActive ); // always prints default value, regardless of ps1.isActive value
}
function isActive2 ( v ) {
print ( v ); // routed to eventIn works fine
}
"
}
ROUTE T1.time TO Program.checkSensor
ROUTE PS1.isActive TO Program.isActive
ROUTE PS1.isActive TO Program.isActive2
looks like eventOut of PlaneSensor not actually routed to exposedField...
Where is a problem ?
There isn't problem.
Accordig to ISO/IEC 14772 Script node contains any number of eventIn, field, eventOut but only one exposedField (exposedField MFString url[]).
http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/nodesRef.html#Script