oriented boundingbox to triangle intersection?

Started by
2 comments, last by superpig 18 years, 7 months ago
So let me start with the basics. I want to determine if a character hits a wall. My thinking was that a bounding box represents the player, and the wall ( a rectangle ) is represented by 2 triangles. Hence, I need to test for an intersection between a bounding box and a triangle. Does anyone have any code that would produce a result for this intersection? Yes, I've seen the 3D intersection table that everyone links. The only example for oriented bounding-box to triangle on that page is to GeometricTools.com. GeometricTools, to my knowledge, does not have an intersection class for oriented bounding-box to triangle. They have box to box, triangle to triangle, even box to plane, but no box to triangle. Or have I missed it somehow? Now, I suppose I COULD split up the box into 12 triangles, and do triangle to triangle tests. But that doesn't seem efficient; my impression is that bounding boxes use the center, axis, and extent of an OBB to determine a radius to the opposing polyhedra. Splitting the OBB into lots of triangles seems wasteful. Does anyone have any good suggestions for how to go about this, the most simple of collisions? Thanks much! Mike
Advertisement
Are your walls allways verticals ?
If yes, just taking into account the intersection between a line (the wall seen from top) and the top and bottom of your bounding box should be enough ?

= Calculate the intersection between the 2 triangles of the top (and 2 triangles of the bottom) of your OBB (in 2D = only x,y coordinate, assume z is up) and the line (segment if you need to be limited) is easy no ? If your OBB has no rotation on X/Y axis, you just have to calculate with 2 triangles (top or bottom) ?
jma
double post
Ironically, of the two forums you posted this in, you didn't hit the right one.

Please don't crosspost topics. I'll close this one and move the other one to M&P.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

This topic is closed to new replies.

Advertisement