What is distanceToRay in raycasting?

The .intersectObjects method returns distance which is explained here and distanceToRay which I cannot find what it is. I couldnt figure it from the source code either (it is the output of a distanceSqToPoint() function)

Does anyone know what distanceToRay is and how it is different to distance?

distanceToRay is only relevant when using THREE.Points.

It represents the distance between the closed point on the ray to a given point in 3D space (to be more precise a single point from a point cloud in this case).

The distance property instead measures the distance between the ray’s origin and the intersection point.

1 Like

Ah ok, thanks. I assume also, if you leave RAYCASTER.params.Points.threshold = 1 (which is the default setting), then whenever an intersection occurs, the distanceToRay will be always less than 1.0