Hudo1979 Posted July 25, 2016 Share Posted July 25, 2016 Hi I am new at Babylon.js What I am try to do is create a scen on mobile devices in portrait view, so I define the canvas size with device width and height, but when I render with cameras, it seems the image rendered in caves is scaled, seems babylonjs have some default camera view of xxx*yyy where xxx is usually larger than y, is there a way to reset the camera angle to fit to the canvas Quote Link to comment Share on other sites More sharing options...
Hudo1979 Posted July 26, 2016 Author Share Posted July 26, 2016 Ok, seems found the problem I did, I seems to set the canvas size at runtime, and somehow the engine was created without the canvas really set, so it always defaults to some rendering size. I now put a delay between setting the canvas size and the creation of the engine, then it works. meteoritool 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 26, 2016 Share Posted July 26, 2016 You can also call engine.resize() to resync the engine Quote Link to comment Share on other sites More sharing options...
Hudo1979 Posted July 26, 2016 Author Share Posted July 26, 2016 the problem seems setting the canvas didn't really triggered the resize event. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 29, 2016 Share Posted July 29, 2016 so you have to call it manually (or add an event listener on your canvas) 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.