meteoritool Posted November 17, 2016 Share Posted November 17, 2016 Hi ! I have an issue that I can't reproduce in the PG ... In order to optimize performance, I use this bit of code at engine declaration : canvas.style.width = "50%"; canvas.style.height = "50%"; var engine = new BABYLON.Engine(canvas, true, { stencil: true }); canvas.style.width = '100%'; canvas.style.height = '100%'; I have a clickable mesh in the middle of the screen set with actionManager, but when I use this canvas resizing trick, the mesh becomes unclickable :/ as if resizing the canvas would make clickable areas inconsistent... Anybody has a clue ? Thx in advance !!! Kemal UÇAR 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 17, 2016 Share Posted November 17, 2016 Hey! I understand what you are trying to do, and have a different approach. Try setting the hardware scale of the engine to a different number than it is. This will achieve the same result (for example, making it 50% of what it is, like what you are trying to do), but will still keep everything clickable and nice and dandy. A quick playground - http://www.babylonjs-playground.com/#1YZ7M3 , line 6 is where the magic happens. Kemal UÇAR and meteoritool 2 Quote Link to comment Share on other sites More sharing options...
meteoritool Posted November 17, 2016 Author Share Posted November 17, 2016 Great ! I will try something like : engine.setHardwareScalingLevel(engine.getHardwareScalingLevel() * window.devicePixelRatio); RaananW 1 Quote Link to comment Share on other sites More sharing options...
Kemal UÇAR Posted November 18, 2016 Share Posted November 18, 2016 wow!! engine.setHardwareScalingLevel(engine.getHardwareScalingLevel() * 2); very nice command , i dont heard before thanks for saying that @RaananW hv nice works RaananW 1 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.