Jump to content

Picking ray issue on mobile devices (caused by hardware scaling)


demonixis
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...