arcanine Posted December 1, 2014 Share Posted December 1, 2014 http://www.babylonjs-playground.com/#1DXDX2I've added an example on the playground Basically with the Orthographic Camera enabled the sphere becomes distorted like a scene that hasn't had the resize engine method applied to it, Is there something I haven't considered? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 1, 2014 Share Posted December 1, 2014 This should work with this fix:http://www.babylonjs-playground.com/#1DXDX2#1 Quote Link to comment Share on other sites More sharing options...
arcanine Posted December 1, 2014 Author Share Posted December 1, 2014 The sphere can still become an oval when resizing the windowIf camera.mode = 0 the sphere doesn't become an oval (this is the ideal behaviour but how to achieve it with mode = 1 camera?) Thank you for having a look and reminding me I must re-watch babylon 5 GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 1, 2014 Share Posted December 1, 2014 ok gotcha!! You have to reset orthoTop/Left/Right/Bottom based on current aspect ratio Quote Link to comment Share on other sites More sharing options...
arcanine Posted December 2, 2014 Author Share Posted December 2, 2014 Cool, got it working, thank you to help any reading to do something similar : This should keep the camera in ratio according to the current orthoTopvar ratio = window.innerWidth / window.innerHeight ;var zoom = camera.orthoTop;var newWidth = zoom * ratio;camera.orthoLeft = -Math.abs(newWidth);camera.orthoRight = newWidth;camera.orthoBottom = -Math.abs(zoom); 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.