argonjs / argon

An open-standards augmented reality platform for the web
http://argonjs.io/
Apache License 2.0
404 stars 73 forks source link

Consider making the subview poses relative to "the user" #19

Open blairmacintyre opened 8 years ago

blairmacintyre commented 8 years ago

When integrating argon with a non-trivial library, like AFrame, it is awkward to have the pose of the camera in each view specified absolutely. For example, there are components in AFrame that want to know where the "camera" is, which all assume the camera is attached to an entity and has it's position/orientation set.

So, I'm having to create an entity with a camera, put it in the scene graph, and set it's pose to the user. BUT, the AFrame graph has the pose of the entity on a THREE.Group which contains the THREE.PerspectiveCamera. Since the THREE renderers pay attention to the scene graph parent/child relationships, if I just use the subview camera directly, I get the pose of ar.user and THEN the pose of the subview camera, which is wrong. So, I'm subtracting the position and orientation of parent, which is a waste of effort.

If we simply make the subview cameras be relative to one pose (ar.user?), we just need to create a parent for the camera that we set that pose to. Since most of our examples already "get" the pose of user, this will be no extra effort.

speigg commented 8 years ago

app.view.getSubviews(ar.context.user) should give you what you need :)

blairmacintyre commented 8 years ago

Cool. But, it doesn't work. In theory, it looks like it should, but the results (while different) are wrong. It's not clear to me exactly what's wrong, but it's like it's missing some of the parent transforms on the desktop when I do that (e.g., it isn't getting the rotation by 90 for the ENU to NUS), and I haven't had the time to debug on the phone.