# 3D rectangle collision

8 posts

 320 posts Two objects are flying through space. Determine exactly when and where the objects will hit. I can figure out the problem when the objects collide at a point, but not when the objects collide along a line. Also I can’t use iterations to solve the problem, so I’m quite stuck. 817 posts Well, this and this might help. You could use the theory of how its done to find the approximate “time” and place a collision of two objects occur. Keep in mind, its for the use of axis-aligned bounding boxes, and I was using it for tile collisions in a platform side-scroller. 7171 posts Also this 320 posts Thanks guys. Actually the AABB and circle-circle collision algorithms are not going to help me. I’m going to use a variety of complex shapes, and I think using AABB will be too inaccurate in this case. Anyway. I think my answer lies in using 3D rectangles and looking for an overlap. So I’m looking for intersection between rectangles in 3D space. Like planes in 3D space, except a lot more limited. Problem is, whenever I look on the Net, I don’t find anything about rectangle-rectangle collision in 3D space. I only get stuff about cuboid collision detection. (Which is why I’m asking.) How would one calculate 2D rectangle-rectangle collision in 3D space? 2102 posts Add a third dimension to your rectangles of 0.01, and interpret em as cuboids. I think this will be enough. 654 posts Plane-plane intersection results in a line of intersection points (line A) If two rectangles intersect in 3D space, the finite lines of intersection between line A and each rectangle must intersect, themselves: Split the rectangles into their four lines, to start with If the line intersects with just one rectangle, it is because the plane defined by the non-intersecting rectangle has to extend out of its bounds to intersect with the intersecting rectangle I don’t know what the cuboid-cuboid algorithm is, but I would have thought it could be helpful I genuinely don’t know for sure if this is mathematically correct, but you’re right in saying that there’s little on this if anything on the web, the way I was searching 320 posts Well, it seems to work. I have an e-book called Real-Time Collision Detection. The book apparently holds some of the most optimized methods of determining collision detection and a lot of the methods are of the most-used methods in the gaming industry. But it mainly went into 3D stuff, which typically is not used a lot in the Flash gaming industry. So when I looked for rectangle-rectangle collision, I didn’t find much. I found plane-plane collision detection. But not much else was found. But your method seems to work though. Also the link was quite good, even if your method is genuinely wrong. Bookmarked :D Thanks! 654 posts Yeah, I like Wolfram’s explanation articles