Hi,
I’m learning ThreeJS, trying out the raycaster.
I have a scene with 3 spheres and a raycaster, now I see 3 intersections, but the 3 intersection points are all on the same spot (clearly visible in the example: ThreeJs Ray Issue - CodeSandbox)
Does anyone know if I’m missing something?
Thank you
You do a raycast, before the position you set on your spheres is applied.
1 Like
Spheres’ transform matrices aren’t updated yet, when you use Raycaster on them.
Try this:
scene.add(sphere1, sphere2, sphere3);
scene.updateMatrixWorld(); // call this method, it'll update matrices of the scene and its descendants