Solved
Detecting collisions
Posted on 2005-05-06
Hey,
I have a load of models. But for the sake of this question, we'll just imagine that I have two models. These models are always cuboids, expressed in terms of top-left-front coord, and bottom-right-rear co-ordinate, i.e:
(x1,y1,z1)
___________
| |\
| | \
| | \
| | \
| | |
|__________| |
\ \ |
\ \ |
\ \|
---------------
(x1',y1',z1')
(x2,y2,z2)
___________
| |\
| | \
| | \
| | \
| | |
|__________| |
\ \ |
\ \ |
\ \|
---------------
(x2',y2',z2')
I need an algorithm to detect whether or not these two models come within a certain distance of eachother (in any of the dimensions).
What's the simplest way to do this? My attempts are incorrect. :-(
Thank you in advance!
Rob.