THREE.Raycaster.intersectObject does not detect far objects
I have a mesh that I want to measure distance between a point and this mesh given origin and direction.
The origin is THREE.Vector3(0,0,0), and direction is THREE.Vector3(0,-1.57,0)
this is similar to webgl_geometry_terrain_raycast in the samples but here I need to test from a far point.
The point of intersection of the mesh is at (0,3600,0). So when I run:
(new THREE.Raycaster(new THREE.Vector3(0,8900,0), new THREE.Vector3(0,-1.57,0),1,50000)).intersectObject(window.terrain, true)
It return empty array because 8900 is too far.
now lets run
(new THREE.Raycaster(new THREE.Vector3(0,3700,0), new THREE.Vector3(0,-1.57,0),1,50000)).intersectObject(window.terrain, true)
now it works fine because 3700 is not far.
I Traced the Issue
I traced the issue and find that it is because this line
if (raycaster.ray.intersectsSphere(_sphere) === false) return; //
in the following function:

raycast: function raycast(raycaster, intersects) {
var geometry = this.geometry;
var material = this.material;
var matrixWorld = this.matrixWorld;
if (material === undefined) return; // Checking boundingSphere distance to ray
if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
_sphere.copy(geometry.boundingSphere);
_sphere.applyMatrix4(matrixWorld);
if (raycaster.ray.intersectsSphere(_sphere) === false) return; //
_inverseMatrix.getInverse(matrixWorld);
_ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix); // Check boundingBox before continuing
if (geometry.boundingBox !== null) {
if (_ray.intersectsBox(geometry.boundingBox) === false) return;
}
Expected behavior
By removing this line of code every thing works find for intersectObject function. However I dont think that it should be removed for other calls.

Platform:
It seems the bounding sphere of your mesh is probably not correct. Please use the forum to ensure that your bounding volumes actually enclose the bounds of your geometries. You can login with your GitHub account.
Sorry, but you have not demonstrated a bug so far. And it's not correct to _use_ GitHub so we find the problem in your application.
The origin is THREE.Vector3(0,0,0), and direction is THREE.Vector3(0,-1.57,0)
Direction vectors in three.js must have unit length: Use THREE.Vector3(0,- 1.57,0).normalize();
Most helpful comment
Direction vectors in three.js must have unit length: Use
THREE.Vector3(0,- 1.57,0).normalize();