I have a 3d space with a list of 3d axis-aligned bounding boxes. Let's call one of these bounding boxes the target
. In addition to all these bounding boxes, I have a position vector, call it start
.
I want to determine if a ray exists that:
- Starts at
start
- Intersects
target
- Does not intersect with any other bounding boxes before intersecting with
target
Here are the approaches I've already tried:
- Testing rays from
start
to all the vertices oftarget
. This doesn't work because it's possible that other bounding boxes block all the vertices, but there is a space in the middle. - Testing rays from
start
through the vertices of nearby bounding boxes, and seeing if any of them intersecttarget
. This also doesn't work for cases where the target is blocked by an AABB where all corners cause rays to diverge from the target.
Is there an algorithm which can find rays like the above? I don't actually need to find the actual ray, just determine whether it exists.