Hello.
I try to check if something is between camera and position in scene. I use raycast but it doesn’t work, it only hits the object from a certain camera position.
const startPosition = this.camera.position;
let direction = new THREE.Vector3();
direction.subVectors( startPosition, positionTarget ) ;
const distance = startPosition.distanceTo(positionTarget);
const raycast = new THREE.Raycaster(startPosition,direction.normalize(), 0, distance );
const intersects = raycast.intersectObjects(this.sceneMeshes);
for (let i = 0; i < intersects.length; i++)
{
console.log(intersects[0].object.name, intersects[0].point)
}
When i use raycaster to from camera then it hit everything on scene properly. How should I check if there are obstacles between two points?