jscastro76 / threebox

A Three.js plugin for Mapbox GL JS, with support for animations and advanced 3D rendering.
Other
562 stars 148 forks source link

A mouse picking bug was found in mapbox 2.11.0 version. #376

Closed thefuturecom closed 1 year ago

thefuturecom commented 1 year ago

When changing the mapbox version from mapbox-gl-js/v2.2.0/ -> mapbox-gl-js/v2.11.0, 3D object picking does not work properly. Up to v2.10.0 version is normal.

You can check it immediately by changing the mapbox version to mapbox 2.11.0 and picking the 3d object with the mouse. Picking is not normal.

html link

See the following code. I don't know the exact reason, but here's the link in the code. //---------------------------------Threebox.js 790 line---------- ---------------------------------------

queryRenderedFeatures: function (point) {

let mouse = new THREE. Vector2();

// // scale mouse pixel position to a percentage of the screen's width and height mouse.x = (point.x / this.map.transform.width) 2 - 1; mouse.y = 1 - (point.y / this.map.transform.height) 2;

this.raycaster.setFromCamera(mouse, this.camera);

// calculate objects intersecting the picking ray let intersects = this.raycaster.intersectObjects(this.world.children, true);

return intersects },

jscastro76 commented 1 year ago

Hi @thefuturecom If the plug-in works well with no changes in 2.10 and previous, and also with 2.2, but not with 2.11… have you considered there could be a bug in Mapbox itself that was resolved? This plug-in does not support all the versions existed in Mapbox and Threejs, and all their possible combinations, which is basically impossible. The versions supported are detailed in readme.md for each release delivered over the last two years.

thefuturecom commented 1 year ago

Thank you for your reply. It seems to be a bug in mapbox 2.11.0 version. We are currently using it after downgrading to version 2.10.0. On our side, we want to keep the latest version as much as possible. We will also try to find out more about the cause and contact you again if we have any helpful data.