Good collision points
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?
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?
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.
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.
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. VerticeVertice, VerticeEdge, EdgeEdge, 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?
Basically you cant find the "penetrating vertices" you need to break it down into different types of penetrations. VerticeVertice, VerticeEdge, EdgeEdge, 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.
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!
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 vertexvertex 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 vertexface collision or cornercorner 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.
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 vertexface collision or cornercorner 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.
Possibly Related Threads...
Thread:  Author  Replies:  Views:  Last Post  
Angle between two points?  Graphic Ace  6  6,012 
Nov 8, 2008 12:11 PM Last Post: macnib 

Algorithm for moving between two points on a plane...  WhatMeWorry  4  5,222 
Aug 23, 2005 11:36 AM Last Post: unknown 

Getting angle between two points  Steven  2  4,205 
Aug 2, 2003 09:26 AM Last Post: Steven 