viromedia / viro

ViroReact: AR and VR using React Native
MIT License
2.31k stars 482 forks source link

Question regarding width height #61

Closed jimji1005 closed 7 years ago

jimji1005 commented 7 years ago

Hi, not an issue more like questions regarding width height.

is width height in relations to the position?

width 1 = position 1x?

Trying to get some kind of bearing to how to scale things up and down.

I don't suppose there is any real world translation on this?

Looking for something like 1 = 1 feet or 1 meter

achuvm commented 7 years ago

Hi @jimji1005,

Units on the Viro platform are in meters.

So all measurements are in meters and all positions are in meters from [0,0,0].

Thanks,

Andy

jimji1005 commented 7 years ago

Nice! Thanks! Please update the doc to include this.

Sorry to segway, a different question

Once AR session initializes, it sets position 0,0,0, which starts tracking cam position.

Is there anyway to reset this without restarting the scene?

achuvm commented 7 years ago

Hi @jimji1005,

No, there's currently no way to reset the camera position.

Is there a reason/use case for doing this?

Normally in AR applications, you'd want your components to "stay" where they have been placed.

jimji1005 commented 7 years ago

yeah for sure

I am testing the feasibility of tracking the position of the phone as it moves around on all 3 axis

thinking of creating a virtual box that can render where is the phone

achuvm commented 7 years ago

Hi @jimji1005,

I'm interpreting your use case in 2 ways:

  1. You would like to render a box around the camera and have it follow the camera around. This is something we don't currently support but is something on our backlog and the idea is to be able to fix things relative to the camera position constantly.

  2. You want to render a box at the current camera position and have it stay there. In this case, you can use the getCameraOrientationAsync() to get the position of the camera at the current time: http://docs.viromedia.com/docs/viroarscene#methods

In either case, you shouldn't have to reset the world to the camera position.

Andy

jimji1005 commented 7 years ago

As for the rendering, i was more thinking about having a server that is tracking the device position.

No worries, i can always use math to track device position in 3axis

I wasn't able to utilize getCameraOrientationAsync for some reason, seems like the method wasn't exposed. i copied the code out and placed it in the demo app to get it to work.

achuvm commented 7 years ago

Interesting, let us know if that doesn't work for you.

That's interesting that you couldn't get getCameraOrientationAsync() working. An example of it working is in our ARSampleApp line 172: https://github.com/viromedia/ViroARSampleApp/blob/master/js/ARHitTestSample.js