0

This is another of my general questionand I am stuck at this point. I have made a W3DS GetScene query in the server and I have got the 3D scene as an output in the viewer. Now I want to trigger the onclick function on the displayed object so that when I click on the object, I can get its id as well as positional co-ordinates in terms of X,Y and Z and use it to trigger GetFeatureInfo request in the background to get the attribute table related to the clicked object. The part I am stuck is about how to trigger the onclick event or lets say how can I make the server understand that the object has been clicked. Is it necessary for the server to have the functionality predefined or is there any other way to instigate the function from the client side with appropriate coding. I have read in some papers that the X3D player BsContact which I am using for viewing the returned 3D scene its own proprietary interface to modify the scene using JavaScript but I am not being able to find a way how?Thanking you in advance.

1 Answers1

0

This is quite not about X3DOM, but about X3D and the way you can route events in an X3D scene.

  • You will have to define a TouchSensor node inside as a sibling of your shape or transform node: <TouchSensor DEF="TCH"/>

  • Then you will have to add a Script node, set its child Field nodes and provide a JS file or JS content as CDATA to describe these fields'handling, as described in the instantreality well written documentation

The interaction between JS in the BS player and JS in the webpage is somehow not well documented. However BitManagement have SDK and support. As far as I know, being able to have both sides communicating with each other is the only way to send a request to you server on click since you succeed in listening to it BS Contact side.

Some years ago, I succeeded in creating such a communication with the Octaga Player: a bidirectionnal communication between, JS Octaga side, JS web page side, and a java applet built with Lejos, receiving and sending orders to an NXT robot.

However: you may now consider X3DOM as the way to display X3D contents on the Web, and so directly avoid any issue on JS(X3D player) to JS(web page) communication.

And then, for implementing event handlers, I let you read this other post on stackoverflow about handling click on an X3DOM shape

Community
  • 1
  • 1
atondelier
  • 2,424
  • 15
  • 11