I am trying to get raycaster to work for my pointcloud using OrbitControls and a PerspectiveCamera. I am loading data from a pcd file (generated in open3d in python). The coordinates are light years, and very large (esp x and z are in the 1000’s).
The canvas only uses part of the page, but I think I managed to at least get the mouse coordinates correctly now by using renderer.getContext().canvas.getBoundingClientRect() to get the bounds of the canvas. When I hover with my mouse I do get mouse coordinates between -1 to 1 for both x and y. But if I then do a raycaster.setFromCamera(mouse, camera), no points are found to intersect. I’m not sure what the cause is.
With the mouse in the top right corner, and a point there too, I log both the calculated mouse coordinates and then log the raycaster.ray and get these results:
It’s not clear to me from the docs what unit/coordinate system the “direction” should be in, but the numbers look a bit low if you compare it to the origin, which seems to be the correct camera position.