Jump to content

Control camera with mobile


Gugis
 Share

Recommended Posts

I want to be able to control camera by mobile device orientation. While tilting mobile up (rotating on X axis) camera glithces and starts spining on y axis, when device beta angle is approx 90 degrees. I don't know if there's any bug or I am doing it wrong. Here's playground: http://www.babylonjs-playground.com/#1ALLVD#8

Try on your mobile device

Thank you for your time :)

 

P.S. Yes I know there's DeviceOrientationCamera, but i need to figure out how to implement it this way.

Link to comment
Share on other sites

Hi @Gugis, good to see you again.  Sorry for the slow replies.  Unfortunately, I have no testing devices, but I have been thinking about what COULD be happening.

http://www.babylonjs-playground.com/#1ALLVD#9

I set a few interesting properties on camera... lines 10-13.  Did anything improve for you?  *shrug*  Hope so.

Link to comment
Share on other sites

Hi,

 

Maybe you should try using the DeviceOrientationCamera instead of breaking your head trying to implement something that is already implemented :)

It is as easy as it gets - http://www.babylonjs-playground.com/#AOYVP

Regarding your implementation, without looking too much - first, using Euler angels will always cause problems, especially when you change the orientation. You also need to make sure you understand the event you are listening to (what do the a/b/g mean, their limits and max-min etc').  If you want to see how I solved it in BabylonJS, you can find the implementation here - https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.ts

 

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...