Raycast to find the lenght of the VertexNormal towards another mesh

you can try this function. point - point of your sphere.
intersectObjects - this is your cylinder

function getIntersectionFromPointbyNormal ( point, normal, object, intersectObjects ){

	object.updateMatrixWorld();

	const localVertex = point.clone();
	
	const globalVertex = localVertex.clone().applyMatrix4( object.matrix )
	const directionVector = localVertex.clone().add( normal.clone().multiplyScalar(1))
	let directionVectorGl = directionVector.clone().applyMatrix4( object.matrix )
	directionVectorGl = directionVectorGl.sub( globalVertex ).normalize() ;
	raycaster.set( globalVertex, directionVectorGl.clone().normalize() );
	let collisionResults = raycaster.intersectObjects( intersectObjects )

	return collisionResults;

}

But I think it will work very slow. Too many rays will be

1 Like