This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > June 2004 > Accessing VRML Node info via Script





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Accessing VRML Node info via Script
KillMeQuickly

2004-05-28, 2:09 pm

Hey everyone,

I've been trying for 2 weeks to do something stupidly simple. I apologize for my ignorance in advance.

1. I have a bunch of objects and each has a TouchSensors on it.
2. I have JavaScript functions that get invoked when the sensors are hit.
3. The problem is if I have 50 TouchSensors, I have 50 functions.

This can't be right, right?!

Shouldn't I be able to ROUTE all my TouchSensors to a single function and then access the Node from there. Um, like this (excuse my bad sloppy psuedo-code):

function userClicked(source)
{
Node node = source.getNodeThatWasClicked().getID();
String id = node.getID();
int x = node.getX();
int y = node.getY();
int z = node.getZ();
... and stuff like that?
}

Thanks in advance for the help.
rh256

2004-05-28, 10:19 pm

Hi,

(sorry bad english)

last year for making button i have the same problem. For solve it
i make a proto wich contains the touchsensor & script, the
proto have two
exposedField MFNode _Model_on[]
exposedField MFNode _Model_off[]

where i put my geometry, it have too some extra field

exposedField SFInt32 _Id -1
eventOut SFInt32 _Push

when i click on the button it return to control script the Id
rh256

2004-05-28, 10:25 pm

sorry i forgotten :

in the proto of course there is also the route between the local
script and local touchsensor

ROUTE _0.touchTime TO _1.push
ROUTE _0.touchTime TO _1.touch
ROUTE _1.choice TO _2.set_whichChoice

That work fine with Bscontact6 and blaxxun, i don't now with other
browser.
KillMeQuickly

2004-06-17, 2:31 pm

I found that all I needed to do was route all my touch sensors to a the hit_point_changed event. That's it, no real coding necessary to get the data. From there I just send it to the web browser via JavaScript calls.

Although, I appreciate the replies, as this may get more complex and I may need to prototype it.



quote:
Originally posted by rh256
sorry i forgotten :

in the proto of course there is also the route between the local
script and local touchsensor

ROUTE _0.touchTime TO _1.push
ROUTE _0.touchTime TO _1.touch
ROUTE _1.choice TO _2.set_whichChoice

That work fine with Bscontact6 and blaxxun, i don't now with other
browser.

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews