## Good collision points

Sage
Posts: 1,478
Joined: 2002.09
Post: #1
I know there are a few people on this board that have implemented some pretty good physics. What is a good way to estimate good collision points?

Many articles say to use the average of the penetrating vertices, but I'm using SAT to determine collisions. So if the SAT test registers a collision, but there aren't actually any penetrating vertices, that would be bad.

I've also seen that some simply apply an impulse at every vertex that is penetrating, but would you have to divide the impulses by the number of impulses, or would applying several full strength impulses be the correct thing to do? The impulses are also really expensive to compute, so applying many seems like kind of a bad idea. And what do you do if objects are colliding but there are no penetrating vertices?

What I've been doing is trying to get a good approximation of the centroid of the collision area. Unfortunately, this tends to make a box laying on the floor vibrate slightly because it ends up overcorrecting the motion of the body to satisfy the collision at the single point. Will applying impulses at all of the colliding points fix this?
Moderator
Posts: 1,140
Joined: 2005.07
Post: #2
I test collisions in the game I'm making find out if any of the edges penetrate. Basically, I find out what point a ray would intersect on the plane, see if it's within the bounds of the line, then see if it's within the bounds of the plane (basically take the dot products of all the vectors to the vertices, going around in a circle, and see if the angles add up to approximately 2*pi radians. You can skip a lot of calculations in the middle if certain things don't fall in range. It works quite well. I don't do any resting objects with physics etc., but I'm sure it wouldn't bee too difficult to figure out.
Sage
Posts: 1,478
Joined: 2002.09
Post: #3
By this point I already know that the objects are indeed colliding and what the collision normal is. And I actually am doing this for resting contacts so I need to know where the collision happened.
Member
Posts: 153
Joined: 2004.12
Post: #4
I had a hell of a time figuring this out.

Basically you cant find the "penetrating vertices" you need to break it down into different types of penetrations. Vertice-Vertice, Vertice-Edge, Edge-Edge, etc... (depending on 3d or 2d). Once you know what "type" of collision it is it should be pretty obvious how to compute where you should apply the impulse.

Do you already do that?

There was a long silence...
'I claim them all,' said the Savage at last.
Sage
Posts: 1,403
Joined: 2005.07
Post: #5
If you want masses to rest on the floor you need to either allow multiple collisions per frame or find the mean of the locations of penetrating vertices and have a sufficiently large friction to compensate for the rebound.

Sir, e^iÏ€ + 1 = 0, hence God exists; reply!
Sage
Posts: 1,478
Joined: 2002.09
Post: #6
hangt5: No I was hoping there was a simpler way that would work without trying to break collisions down into categories. (in 2D anyway) What exactly do you mean by vertex-vertex collisions? Would that be the case when two corners intersect?

What I am doing is using SAT to test for interference and find the seperating axis. So that somewhat blurs the need to determine if it's a vertex-face collision or corner-corner collision. (I think)

I think I might change it to allow for multiple collision points per collision. After thinking about it, this does make sense because each impulse will affect the relative velocity in the ones applied afterwards. I kept thinking that applying an impulse to both bottom corners of a box would be problematic because it would make it bounce twice as high as is should or some other nonsense.

I tested this by allowing a box to sit on two separate surfaces so that it would get collision impulses on two corners every iteration. This was significantly more stable than using a single collision point at the approximated centroid of the collision. So this seems like it might work.
Member
Posts: 208
Joined: 2005.04
Post: #7
Check this out.
Sage
Posts: 1,478
Joined: 2002.09
Post: #8
Andrew Wrote:Check this out.

Already using SAT, but thanks.