I have some problem with PlaneSensor.
I have one Transform node with Viewpoint and NavigationInfo
node. I have another Transform node with some Shape object.
I define one PlaneSensor and I put it in the second Transform
node with the Shape. If I use a ROUTE to move the Shape
there is no problem, but if I try to move the camera insead of
the object it does not work properly. I do the follow:
In a Script node I define a function "eventIn SFVec3f drag":
function drag(value,time) {
camtrans.translation[0]= -value[0];
camtrans.translation[2]= -value[1];
}
I am using this ROUTE:
ROUTE PLANE_TOUCH.translation_changed TO SCRIPT.drag
...
That works:
#VRML V2.0 utf8
DEF camtrans Transform {
children Viewpoint {
description "Main"
}
}
DEF main_PLS PlaneSensor {}
Shape {
geometry Cone {}
}
DEF main_SCR Script {
eventIn SFVec3f go
field SFNode camtrans USE camtrans
url "javascript:
function go(val){
camtrans.translation[0] = -val[0];
camtrans.translation[2] = -val[1];
}
"
}
ROUTE main_PLS.translation_changed TO main_SCR.go