Sign in to follow this  

Comparing axes in a SAT based collision resolution method

This topic is 2055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've implemented a Separating Axis Theorem-based collision detection function (in C++) and am now dealing with resolving collisions. What I need to figure out is how to detect which axis is best to resolve the collision.
What would be a good way to compare several vectors to an inverted translation vector in order to determine which axis will result in the best possible collision (basically the axis closest to the translation vector)?

I think I could use something like each normal in the static object stored an angle (0-360, probably 9 bits, or an int, whatever) and the translation vector structure also contained an angle (for now it's limited to increments of 45 because of keyboard-based controls). The static angles would all be compared to the translation angle, and the closest static normal would be used as the resolution vector.

Is there anything more efficient/better to use to compare the vectors, or should I use a completely different method in order to resolve the collisions?

Share this post


Link to post
Share on other sites
If there is a collision the objects have no separating axis. Maybe you want to find the direction along which two overlapping objects need to be displaced by the minimum amount to cease overlapping, but it's a mere hack.
For an exact collision response you have to compute the time of impact and the position of objects when they touch. At that time and place, the objects bounce, start deforming, etc.

Share this post


Link to post
Share on other sites
[quote]In SAT it's axis with minimal projection overlaping.[/quote]
The reason why I don't do that is because when the objects near each other's corners the minimal axis becomes the axis on the wrong side of the shape, making a horrible tunneling effect.

I'm not really making an exact collision detection method, just a simple, versatile one for basic game collisions.

How difficult is it on the CPU to compute the time/position of impact? I'd imagine to use a method where it splits the total translation in half, sees if there is a collision or not, then splits a portion of that in half and so on.

Share this post


Link to post
Share on other sites
[quote]The reason why I don't do that is because when the objects near each other's corners the minimal axis becomes the axis on the wrong side of the shape, making a horrible tunneling effect.[/quote]
Then you definitelly need time prediction algorithm. The same SAT is good. I wrote a post long time ago - check it out
[url="http://volgogradetzzz.blogspot.com/"]http://volgogradetzzz.blogspot.com/[/url]

Share this post


Link to post
Share on other sites

This topic is 2055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this