FlashyGoblin Posted March 9, 2016 Share Posted March 9, 2016 So when implementing the DeviceOrientationCamera on mobile, and the device changes from portrait to landscape, the camera controls don't update to the new orientation. It remembers the original portrait orientation, they don't switch over to the landscape controls. Any idea on how to correct this? Here is an example. On mobile, start in portrait, and then rotate to landscape. You'll see the controls get all wonky. http://www.babylonjs-playground.com/#PNQPP#1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted March 9, 2016 Share Posted March 9, 2016 2 things: 1 You may need to tell the engine. Resize for a browser is shown below. You might need to find the event for orientation switch window.addEventListener("resize", function () { engine.resize(); }); 2. I am not sure resize() is going to work, but would try that first Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted March 9, 2016 Author Share Posted March 9, 2016 Thanks for the reply! Yes, I have the resize listener implemented (just not in the playground example I posted), but the problem still exists. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted March 9, 2016 Share Posted March 9, 2016 You did not listen to #1. I found this in 5 seconds https://davidwalsh.name/orientation-change dbawel 1 Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted March 9, 2016 Author Share Posted March 9, 2016 I know the orientationchange event, but again, that's not the issue. I'm asking if there is a way to update the camera so it knows that the orientation has changed. Calling engine.resize() on either the window's resize or orientationchange event doesn't do the trick. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 9, 2016 Share Posted March 9, 2016 Yep we have orientation problems with this camera and had no time for now to fix it, feel free to jump into if you wish to contribute (related thread) Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted March 10, 2016 Author Share Posted March 10, 2016 Thanks for the update, Vousk-prod! I'll take a look. 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.