focomoso Posted August 21, 2017 Share Posted August 21, 2017 In babylon v2.5, engine.getRenderWidth() and .getRenderHeight() return doubled what's expected on retina displays. Scene.pointerX and .pointerY do not, so in order to match screen clicks to objects in the scene, you need to multiply the renderWidth and height by engine.getHardwareScalingLevel(). This means that the preferred way of getting the screen coordinates of an object: BABYLON.Vector3.Project( BABYLON.Vector3.Zero(), BABYLON.Matrix.Identity(), scene.getTransformMatrix(), camera.viewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight()) ); Will fail on retina displays. It seems more intuitive for getRenderWidth and height to do the scaling themselves. (Or, as has been mentioned before, I think, adding a specific object to screen method on scene or engine). Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 21, 2017 Share Posted August 21, 2017 This is fixed by 3.0 and 3.1 Quote Link to comment Share on other sites More sharing options...
focomoso Posted August 21, 2017 Author Share Posted August 21, 2017 Thanks. 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.