Three js custom raycaster

export function z(x, y) { const origin = new THREE.Vector3(x - ref.cloud.offset[0], y - ref.cloud.offset[1], 0) const direction = new THREE.Vector3(0, 0, 1).normalize() const raycaster = new THREE.Raycaster(origin, direction) raycaster.params.Points.threshold = 0.1 const intersects = raycaster.intersectObjects(ref.cloud.pointclouds, true) intersects.sort((a, b) => a.point.z - b.point.z) return intersects[0].point.z + ref.cloud.offset[2] }
 
Three js raycaster WITHOUT camera
I seem to find only examples to use the raycaster with the camera, but none that just have a raycaster from Point A to Point B. I have a working raycaster, it retrieves my Helpers, Lines etc. but it seems it does not recognize my sphere.
Three js raycaster WITHOUT camera
 

Recommendations