Raycaster ray length

hello

is there a way to shorten the ray, i mean i know how to get collision detection,
but i want it to append only when that the camera hit the wall, now when i face the the camera and
i get TRUE return on camera facing the wall, i want it show TRUE only when the camera hit the wall

thanks a lot

Can you explain a bit more or make a jsFiddle?

You can set near and far of the raycaster

 raycaster = new THREE.Raycaster(
        origin,
        direction,
        near, 
        far // How far the ray will go
 )

This isn’t how the raycaster works, in fact it isn’t a ray going from the start through your scene, it performs basic bounding sphere/box checks and then against the geometry, through the hierarchie without order related to a ray, means that the first object it tests with might be even the most distant. The result list is sorted by distance then.

1 Like

thanks , still try to find a answer.
what will be the best way to check if the camera is interacting with a WALL in a scene?
so i can make the player stop moving forward