Jump to content

How target the camera to the real world orientation ?


Recommended Posts

Hi,

I would like when I start the device orientation camera that the orientation is as a real world?

For example, if I create 4 cubes around me with north, east, west and south, I want to see the north cube when my smartphone is facing north.

Thank you very much in advance for your help.

Stephan

Link to post
Share on other sites

I think you would have to build in your own compass to stay oriented to the real world.

It looks like it can already be done on Android, but don't hold your breath for Apple PWA support:

https://caniuse.com/#feat=deviceorientation

https://caniuse.com/#feat=gyroscope

https://caniuse.com/#feat=magnetometer

https://caniuse.com/#feat=accelerometer

 

 

Link to post
Share on other sites

Thank you for your feedback and research track, but I would have liked a solution directly with Babylon because I am not yet very comfortable with javascript. I went through the forum and the playground without success: -(
It is to create a POC to help our students find important places in the school.
This may not yet be possible with the current version of Babylon, @Deltakosh Can you tell me if there's a solution I may have missed? Thank you and sorry for the inconvenience. 

Link to post
Share on other sites

Well, it's not possible without accessing the phone's sensors. There's some extra work that you have to put in, first go through http://docs.phonegap.com/en/edge/cordova_compass_compass.md.html, and then copy paste the demo scene code. Then package your app and it's done ! or wait for some days, I'll may publish the code here :)  

Link to post
Share on other sites

We offer the DeviceOrientationCamera to support phone sensors. Then you need to setup your scene and position the camera initially in the good direction:

http://doc.babylonjs.com/api/classes/babylon.deviceorientationcamera

 

The complex part in your code would be the initial setup (You could perhaps setup the phone to start facing north or something)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...