From: FDS <dan...@fu...> - 2014-08-28 11:59:18
|
Hi Yvonne, I piggy back on this thread to ask you all where i can find a documented list of X3Dom functions such as: > new x3dom.Moveable(boxes, redBox, moveCallback, 0); which is used in the example you have posted. I could not find this in any of the X3Dom documentation. Thanks, regards Daniel On 28/08/2014 10:26, Jung, Yvonne wrote: > Hello Leonard, > > Am 28.08.2014 um 07:32 schrieb "Leonard Daly" <we...@re...<mailto:we...@re...>>: > > Yvonne, > > Thank you for your previous answers. I am now capturing all viewpoint change events. I found it easy working with the viewpoint position. I can't figure out how to get an SFRotation from the 'orientation' field object in the event. It looks like I can use > > event.orientation[0].x/y/z to get the first three elements, but I don't see a way to get theta. x, y, and z are the only field 'values', the remainder of the items are functions. > > The angle is simply in orientation[1]. > > For doing calculations, you can use the internal x3dom.fields.Quaternion type (as defined in about the middle of the x3dom math lib JS file): http://www.x3dom.org/x3dom/src/fields.js > > > It might be easier to get the rotation matrix and work with that if it is available. > > Yes, just use event.matrix > > Best regards > Yvonne > > > Thank you, > > > Leonard Daly > > > > Hello Leonard, > > event naming in HTML differs between the way you attach a callback. If you use attributes like in your example, it is with an ‘on’ prepended (also, in this case, the formal parameter of your method must be named ‘event’). > With DOM level 2 event listeners, which cannot be attached before document.onload(), it is without an ‘on’. > > Here is a working example (see output in text window below when navigating): http://examples.x3dom.org/example/x3dom_uiEvents.html > > To use attributes as in your example, the code would look like this: > <viewpoint onviewpointChanged="viewFunc(event);"></viewpoint> > > And this would be in the <script>: > function viewFunc(event) > { > var pos = event.position; > var rot = event.orientation; > // … > } > > Best regards > Yvonne > > > > Von: Leonard Daly [mailto:we...@re...] > Gesendet: Dienstag, 26. August 2014 06:40 > An: x3d...@li...<mailto:x3d...@li...> > Betreff: Re: [x3dom-users] Trying to Capture Events > > On 8/22/2014 12:46 AM, Jung, Yvonne wrote: > > > > > > > > > > My original intent was to capture the current view position using ProximitySensor. That node is not yet available in X3DOM. What is the preferred means for capturing the current camera position and orientation? > > > > Just use the viewpoint's > > viewpointChanged event, the event object contains all information. > > Yvonne, > > Thank you for the tip. I must be doing something wrong. I can't find an example that uses that event, and I can't get it to work. I think I am trying to capture something that doesn't exists. My viewpoint node is: > > <viewpoint DEF='Viewpoint-Right' id='x3d_viewpoint_right' viewpointChanged='updatePosition(event);'></viewpoint> > > I have use the following variations of viewpointChanged: > * viewpointchanged > * onviewpointChanged > * onchange > * onoutputchange > * viewpointchange > * onviewpointchange > > > updatePosition is a JavaScript function in the HTML5 page that writes that an event was processed to a textarea. > > > Suggestions or corrections are highly welcomed. > > Thanks, > > Leonard Daly > > > > > > > > > > > > Best, Yvonne > > > > > > Thank you. > > > > -- > > Leonard Daly > > X3D Co-Chair > > Cloud Consultant > > President, Daly Realism - Creating the Future > > ------------------------------------------------------------------------------ > > Slashdot TV. > > Video for Nerds. Stuff that matters. > > http://tv.slashdot.org/ > > _______________________________________________ > > X3dom-users mailing list > > X3d...@li...<mailto:X3d...@li...><mailto:X3d...@li...><mailto:X3d...@li...> > > https://lists.sourceforge.net/lists/listinfo/x3dom-users > > > > -- > Leonard Daly > X3D Co-Chair > Cloud Consultant > President, Daly Realism - Creating the Future > > > -- > Leonard Daly > X3D Co-Chair > Cloud Consultant > President, Daly Realism - Creating the Future > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > X3dom-users mailing list > X3d...@li...<mailto:X3d...@li...> > https://lists.sourceforge.net/lists/listinfo/x3dom-users > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > X3dom-users mailing list > X3d...@li... > https://lists.sourceforge.net/lists/listinfo/x3dom-users |