Original Post
I'm trying to write a function for my game that returns the distance to the nearest collision along a direction. It is fed the following data:
Vector3D origin (Point to start search from)
Vector3D volume (Halfwidths)
Vector3D direction (Direction to check)
The function iterates over a list of "Areas" that are really just axis aligned boundary boxes and attempts to return a distance in the form of a double.
But now I've gone and stirred myself blind on it and need some help. The approach that first came to my mind was to project the boxes to the direction, and when I realized that wouldn't work I thought I'd store the normals of the iterated boundary boxes somewhere instead and then do a separating axis test, like what is common in 2D.
But then it seems I'd be needing an oriented bounding box test. Is that really necessary? I mean considering the boxes are all aligned.
I'd like to know what the correct way to do this would be? Thank you.
Vector3D origin (Point to start search from)
Vector3D volume (Halfwidths)
Vector3D direction (Direction to check)
The function iterates over a list of "Areas" that are really just axis aligned boundary boxes and attempts to return a distance in the form of a double.
But now I've gone and stirred myself blind on it and need some help. The approach that first came to my mind was to project the boxes to the direction, and when I realized that wouldn't work I thought I'd store the normals of the iterated boundary boxes somewhere instead and then do a separating axis test, like what is common in 2D.
But then it seems I'd be needing an oriented bounding box test. Is that really necessary? I mean considering the boxes are all aligned.
I'd like to know what the correct way to do this would be? Thank you.