Gugis Posted August 19, 2016 Share Posted August 19, 2016 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. Johnny007 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 21, 2016 Share Posted August 21, 2016 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. Quote Link to comment Share on other sites More sharing options...
RaananW Posted August 22, 2016 Share Posted August 22, 2016 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 Quote Link to comment Share on other sites More sharing options...
Gugis Posted August 22, 2016 Author Share Posted August 22, 2016 Hi, thank you for your answers guys. I think I will do as RaananW suggests (using DeviceOrientationCamera). Sorry for useless topic :/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.