Closed younggis closed 1 year ago
Check the documentation for utils.projectToWorld
Thank you. The method you gave is to turn WGS84 into the world coordinates of three. Now I want to turn the intersection into the world coordinates, like the following code.
this.mapgl.on('click', (evt) => { let intersects = tb.queryRenderedFeatures(evt.point) if (intersects.length) { let feature = intersects[0]['object']; let worldcoordinate = tb.unprojectFromWorld(intersects[0]['point']); } })
I need to save the geographic coordinates corresponding to this intersection.
@jscastro76 Please take a look
I solved it
let p = new THREE.Vector3(intersects[0]['point']['x'], intersects[0]['point']['y'], intersects[0]['point']['z']) let marinverse = new THREE.Matrix4(); marinverse.copy(tb.world.matrix).invert() console.log(tb.unprojectFromWorld(p.applyMatrix4(marinverse)));
queryRenderedFeatures returns the screen coordinates of the intersection, but how to convert them to world coordinates?