[WWW-Vrml] PlaneSensor Issues

Bederov, Sergey bederov at cortona3d.com
Fri Jul 15 06:49:35 PDT 2011


Hello Matt,

First I'd note that your VRML file has some errors. It doesn't have a VRML header, the PlaneSensor contains values of events (in VRML nodes outside of PROTO can only contain fields and exposedFields), and in the Script an SFBool value is defined as "false" (VRML requires "FALSE" in upper case). Just wondering which VRML browser are you using?

In Cortona3D Viewer, your file works in a strange way: when I press the mouse button, the box jumps away in a random (?) direction, but then moves together with the mouse. On the other hand, when I set autoOffset to TRUE and remove the script, everything works just fine. Maybe the VRML browser you are using has some errors with PlaneSensors?

For example, the browser may not like an offset not lying in the XY plane (this could be the cause of the motion being very slow, for example, the mouse motion could be mapped to the Z=-10 plane while the box was moving in Z=0). You could try to wrap both box and sensor by a new Transform which would translate everything to Z=-10, then you would not need any offset at all.

Otherwise, if you still need to simulate the autoOffset (or your VRML browser forces you to do so), you should route translation_changed instead of trackPoint_changed to the script. In Cortona3D Viewer, this eliminates the jumps I mentioned above. Please try and see if it works for you. Note the difference: trackPoint_changed is the point the mouse points to; translation_changed is the actual translation of the box.

                                             Sergey Bederov


From: www-vrml-bounces at web3d.org [mailto:www-vrml-bounces at web3d.org] On Behalf Of Matthew Fox
Sent: Wednesday, June 29, 2011 9:47 PM
To: www-vrml at web3d.org
Subject: [WWW-Vrml] PlaneSensor Issues

Hi,

I have been working with drag sensors, specifically the PlaneSensor, and I have come across an issue with the trackpoint feature of the PlaneSensor.  I am attempting to drag a box along the xy plane that is positioned -10 units along the z plane.
Because of this, I set my own offset to 0, 0, -10 for the sensor, but the dragging motion became very jumpy due to the lack of correction that I took away by setting my own offset, and the box did not translate exactly with the mouse, but a good bit less.  Therefore, I wrote a script to feign an autoOffset and routed it to the set_offset field of the PlaneSensor so that it would begin where the last drag had ended.  This works very well in all cases except for the first attempt at dragging, which behaves as it did before.  Also, when a second click is activated, the box jumps to correct its translation and then acts on the correct translation of the mouse.  I was wondering if any of you would know how to fix it to correct for this problem.  I'll attach some sample code to this message.  Thanks so much.

Sincerely,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/www-vrml_web3d.org/attachments/20110715/175522fb/attachment.html>


More information about the Www-vrml mailing list