   Swept OBB against Polygon Soup
  I've implemented a collision system that uses a swept sphere against polygon soup and it works just about perfect! Much of it comes from Kasper Fauerby's tutorial on collision detection and response. My problem is however, I'll likely be using some rectangle shaped objects collision. I thought about adding spheres at the corner of the rectangle and testing as a collision hull but that would allow it to pass through objects and seems potentially wasteful.Would anyone happen to know a source to do a OBB cast or recommend an alternative? It seems SAT often pops up for use with OBBs but collision between OBB and polygon soup is something I don't think I've come across. I imagine OBB-Triangle testing has a lot to do with the result, but because of the triangle edges, I would think there would be errors moving out the least penetration.   
here's some code and demo and stuff for OBB vs OBB.Here's the algorithm. I think the demo code is slightly different.Triangle vs OBB is just the same, some axes of projection are just different.   ;  Thanks!I tried out the code and it works well. I even bumped played around with an extremely high gravity. So I did some very ugly tweaking to make the ground out of triangles. I'm not exactly sure how the collision response is working but as I predicted  the boxes are bouncing off to the side when they land on the triangle too close to the edge where the triangles meet.This could be something I'm doing so I think I'm going to try making the ground out of 2 or 4 OBBs and checking if the same thing happens. If it does it with triangle edges I'm guessing it would do the same with box edges.   ;  Sorry that took so long, but yes the same eror occurs with boxes also. To recreate it, create a variable name sidecount. And replace bodycount with sidecount where each body is being updated. This will prevent the blocks from hitting eachother.Replace where the walls and floor are being created with the following...bodycount = 0;bodies[bodycount++] = Body(Box(Vector( width/2+width/4, -thick/2,  depth/2+depth/4), Vector(width/2/2,  thick/2, depth/4), orient, 0xff802020));bodies[bodycount++] = Body(Box(Vector( width/2+width/4, -thick/2,  depth/2-depth/4), Vector(width/2/2,  thick/2, depth/4), orient, 0xff802020));bodies[bodycount++] = Body(Box(Vector( width/2-width/4, -thick/2,  depth/2+depth/4), Vector(width/2/2,  thick/2, depth/4), orient, 0xff802020));bodies[bodycount++] = Body(Box(Vector( width/2-width/4, -thick/2,  depth/2-depth/4), Vector(width/2/2,  thick/2, depth/4), orient, 0xff802020));sidecount= bodycount;Also set the gravity to-700 as opposed to -10When you run the simulation you'll see blocks that land near the edges will bounce off while others land safely in one spot.;  I'll have a look over the weekend. It could be because I'm not sorting my collisions..e. only take into account the first collision, and recursively apply the algorithm. If you don;t do that for environment meshes, you may find the collision response erratic.   ;  I've done a bit of homework and the only way I can see of fixing this is to somehow detect the seams and ignore them which I can find absolutely no documentation on. I guess that could mean this isn't really that big of a deal and people don't notice the jolt when objects hit the seams at high velocity.Still... I'm sure there's some relatively simple solution.Update: Okay while recusion (if I was even doing it right) didnt' work, having all the boxes point up seemed to fix the problem. By my logic if an object was on the crack and moved downward at a constant high velocity, the object would eventually fall through the object but it didn't. Clearly there's something in the code I haven't read into.I think I'll try actually implementing it instead of modifying code for sake of theory and see how it goes : )![Edited by - AntiGuy on May 15, 2010 11:33:06 AM];  Welp everything works! Thanks for the help!One point you may find worth looking into though. Cutting the floor in half, commenting out the line to create the random orentations and using unoriented boxes will cause some boxes to hit some invisible ground even when there are clearly axes separating it from the floor.To fix this, I had to comment out your optimization to ignore axes perpendicular to the velocity for collision.// velocity perpendicular to axis or axis degenerate or velocity too small. ignore test.//if(fabs(v) < 1.0E-8f) //return true;Anyhoo, much obliged!   ;  Ah yes, that'a a bug :/ Should beQuote:// velocity perpendicular to axis or axis degenerate or velocity too small.if(fabs(v) < 1.0E-8f) {// if intervals do not overlap, no collision.return (d0 >= 0.0f && d1 >= 0.0f);};  I've fixed the demo as well.