   Object colliding with many ground polygons
  So it's a very simple problem when you have a mass resting on a slope to generate a normal force to keep it on the slope and not fall through. But what about if I have a sphere/box which covers rests on more than one polygon in my map? It could even rest on two horizontal polygons with the same height but using the simple model the upwards force would then be twice gravity so it would take off! How do I divide up the downwards force properly?And what about this:As the two polygons get steeper the normal forces get less and less vertical - where does the force come from mathematically to keep the ball up?[edited by - d000hg on February 11, 2004 12:50:50 PM]
I''m having basically the same problem than you in my collision detection system.the main problem is that most collision detection algorythms, and most of the collision detection stuff discussed in gamedev talks about single primitive vs single primitive collision detection... but properly management of multiple primitives colliding at the same time is a whole new world.Taking your sample, if you run a collision test you would get these steps:-sphere with LEFT plane collision detected.  -> response: left plane pushes sphere to the right and up-sphere with RIGHT plane collision detected.  -> response: right plane pushes sphere to the left and upleft and right pushes are mutually canceled, so it only remains the up push.But I haven''t been able to properly implement this in actual code... any ideas on how to do this?;  I have implemented this in code as a recursive function. First it sees the collision with the left polygon. It slides down the polygon by going back into the collision detection routine. When it goes back into the routine, it sees that it cannot slide down because of the right polygon. It keeps going back into the routine until its velocity is zero. This can be many iterations, so I need a way to make this more efficient.   --------------------------------------I am the master of stories.....If only I could just write them down... ;  I''m trying to do it all using maths and forces so ie the upwards force needs to be equal to gravity for it to rest there. I want to individually find all the forces acting on each body, then add them as vectors and apply this to the body. Done right this should stop stuff going through each other and the ground.But even if my box is resting across 2 identical joined polygons, how do I split the up force properly? ;  usually, you calculate the force on one polygon, and add it to the object net force accumulator, and then you do the same on the other polygon, which will add another force into the object''s net force. Combined together, they will cancel the gravity. if you want to worry about multiple contacts and stability, it''s complicated. it requires solving a set of linear equations. and when you calculate the collisoin impulse force, you might find that the force is not enough to cancel gravity (since the collision impulse force is usually dependent on the impact velocity, which is 0 when the object rests).  ;  In a 2D program, I had a circle sliding against lines.  Whenever the circle''s intended movement was altered because of a line, I tracked which line caused it to be diverted.  Then if another line altered this new movement and forced it against the last line it slid against, I stop the movement.  Seems to work.This gets more complicated in 3D, though.  If you get two slanted polygons, a sphere could slide against both of them, but still have somewhere to go because the line of intersection between the two polygons has a downward slope (assuming the force moving the sphere is gravity)... ;The problem is that although it is very uncommon to have a hole in the ground where a ball can go in, it is very common to have two walls at 90 degrees, and a box (a player) or anything else collides with both walls at the same time (the box is in the corner)... you have to compute both walls tooa problem I''m having now is that in my collision detection system (OBBs against triangle soaps) sometimes, the box hits a wall... since a wall is built by two triangles, the collision test sometimes fail, because instead of sending the box back, the box gets stucked between the two triangles (every triangle pushing the box against the other)I think this is a common problem with boxes vs triangle soaps collision detection algorythms...is there any links to papers on how to properly handle collision detections with multiple triangles? 