Original Post
Note: 3D not 2D
OBB-OBB (oriented bounding box) intersection tests are fairly well covered (separating axis) but I can't find much information about generating intersection data (contact point, normal, penetration depth) for collision response.
I'm using a separating axis test to determine whether or not they are in contact. If they ARE I need to generate collision data. This is what I have/know currently.
for vertex-face collisions:
Test each vertex of each box against the other box to see if it lies within its boundaries. If it lies within the box's boundaries use the closest face's normal as the contact normal, and the distance to that face as penetration depth. This seems fine although it seems like a lot of tests? (16, one for each vertex on each box)
for edge-edge collisions:
Test each edge from each box against each other. This is what I'm not too sure about. The only method I can find is to do a test on each edge line to find the closest points on each. Then determine if these points lie on the segments of the lines that make up the edge. If so test whether point a is closer to the center of body b than point b, and vice versa. This seems massively inefficient. 12*12 = 144 tests, and it's a pretty expensive test.
Can anyone shed any light (or links) on this?
Cheers
edit: numbers
OBB-OBB (oriented bounding box) intersection tests are fairly well covered (separating axis) but I can't find much information about generating intersection data (contact point, normal, penetration depth) for collision response.
I'm using a separating axis test to determine whether or not they are in contact. If they ARE I need to generate collision data. This is what I have/know currently.
for vertex-face collisions:
Test each vertex of each box against the other box to see if it lies within its boundaries. If it lies within the box's boundaries use the closest face's normal as the contact normal, and the distance to that face as penetration depth. This seems fine although it seems like a lot of tests? (16, one for each vertex on each box)
for edge-edge collisions:
Test each edge from each box against each other. This is what I'm not too sure about. The only method I can find is to do a test on each edge line to find the closest points on each. Then determine if these points lie on the segments of the lines that make up the edge. If so test whether point a is closer to the center of body b than point b, and vice versa. This seems massively inefficient. 12*12 = 144 tests, and it's a pretty expensive test.
Can anyone shed any light (or links) on this?
Cheers
edit: numbers