waverider Posted January 7, 2018 Share Posted January 7, 2018 I changed the scale of my rendering canvas but the pointer coordinate somehow gets messed up. how can i set the pointer coordinate for buttons, here's my code: var coord = new BABYLON.Vector2(scene.pointerX/4, scene.pointerY/4).normalize() button1._onPointerDown = function(button1, coord){ console.log(coord) } or is there a set function for this control.getLocalCoordinates(coordinates) something like control.setCoordinates(new coordinates)? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 8, 2018 Share Posted January 8, 2018 Hello! did you use the engine.setHardwareScalingLevel API to scale the canvas? (This should work if you did ) waverider 1 Quote Link to comment Share on other sites More sharing options...
waverider Posted January 8, 2018 Author Share Posted January 8, 2018 @Deltakosh yes i did and i used these too canvas.style.width = "25%"; canvas.style.height = "25%"; canvas.style.webkitTransform = "scale3d(4.0, 4.0, 1.0)"; canvas.style.webkitTransformOrigin = "0 0 0"; Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted January 9, 2018 Share Posted January 9, 2018 can you do a PG example? Quote Link to comment Share on other sites More sharing options...
waverider Posted January 9, 2018 Author Share Posted January 9, 2018 @Pryme8 here's a pg: https://www.babylonjs-playground.com/#XCPP9Y#400 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 9, 2018 Share Posted January 9, 2018 You cannot use CSS transform to achieve this. Only use engine API: https://www.babylonjs-playground.com/#XCPP9Y#402 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.