demonixis Posted May 12, 2014 Share Posted May 12, 2014 Hi guys! Since the last update I've an issue with babylon.js and picking ray. Here is my code: var ray = _scene.createPickingRay(event.clientX, event.clientY);It works as expected on PC but not on mobile. For having this method working I need to remove Hardware Scaling support in viewport object and in createPickingRay method. So with this hack it's works :// babylon.scene.jsScene.prototype.createPickingRay = function (x, y, world, camera) { // Code return BABYLON.Ray.CreateNew(x, y, viewport.width, viewport.height, world ? world : BABYLON.Matrix.Identity(), camera.getViewMatrix(), camera.getProjectionMatrix());};// babylon.math.jsViewport.prototype.toGlobal = function (engine) { var width = engine.getRenderWidth(); var height = engine.getRenderHeight(); return new Viewport(this.x * width, this.y * height, this.width * width, this.height * height);};My test has been done on a Nexus 7 (latest chrome and Android) and Nexus 4 (latest chrome and Android). Have you an idea about this issue ? demonixis. Quote Link to comment Share on other sites More sharing options...
AndyBeaulieu Posted May 12, 2014 Share Posted May 12, 2014 I think a related issue is, on a desktop browser like IE11, if you change the browser scale settings to something other than 100% (using Ctrl+ or Settings/Zoom), then picking ray fails there as well. So this might be a general issue with scaling and pick ray? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 12, 2014 Share Posted May 12, 2014 I do not have this issue with ie11 when using let's say 125% Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 12, 2014 Share Posted May 12, 2014 Ok you're right! It is due to how I compute the width/height right nowI'll fix it 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.