2

io3d.scene.getAframeElements api returns the waypoints

<a-entity tour-waypoint="TOP VIEW" io3d-uuid="2c0c947b-5135-456d-9626-8c80778b9dd5" position="" rotation="" scale="" visible=""></a-entity>

The position and rotation are empty. How can I get the pose data for each waypoints ?

Tejas Pandya
  • 3,987
  • 1
  • 26
  • 51
Felix Chang
  • 209
  • 1
  • 5
  • 1
    Dear Felix, this looks like a bug and I created a bug report here: https://github.com/archilogic-com/3dio-js/issues/114 I will update you as soon as the issue is resolved. Thank you – Madlaina Kalunder Dec 19 '17 at 10:24
  • Do you have the updates for this issue ? The bug is still existed at 1.1.1 3d.io version – Felix Chang Jan 09 '18 at 07:22
  • It seems getAframeElements waypoint works only at the environment without aframe. But we would like to dynamically insert dom elements at aframe after app started, any solutions ? – Felix Chang Jan 11 '18 at 06:44
  • It works also with A-Frame, the difference is that it's not being shown in the DOM. For more details, see below :) – geekonaut Jan 11 '18 at 14:53

1 Answers1

1

Took us a while to figure this one out, sorry for the delay.

First things first, it worked with A-Frame just fine as this glitch demonstrates. The fact that the position and rotation don't show up in source code doesn't mean they don't work.

The reason for that is that A-Frame turns the attribute values into objects and objects aren't displayed in HTML sourcecode as (per standard) attribute values have to be strings. The fact that they aren't is not caused by us but by A-Frame and is, in fact, not a problem normally - it's the opposite as it is an optimisation.

Now you might want to show the information as part of an HTML dump (e.g. by displaying innerHTML in a textarea, then this is a problem.

That problem can be overcome by calling flushToDOM on the elements, like in this glitch. This affects all dynamically created A-Frame elements, not only 3d.io elements, by the way - you see this with the box element.

I hope this answers your question?

geekonaut
  • 5,714
  • 2
  • 28
  • 30
  • Hi, I realized that can read the pose data from the object attributes, but attribute needs the time to fill in the data, otherwise the data is undefined. I need to retrieve the data at timeout function, such as you log the data at button event handlers. – Felix Chang Jan 12 '18 at 06:01
  • Do you happen to have a code sample that demonstrates your problem? – geekonaut Jan 12 '18 at 07:22