Jump to content

  • Log In with Google      Sign In   
  • Create Account


Comparing axes in a SAT based collision resolution method


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 makuto   Members   -  Reputation: 828

Like
0Likes
Like

Posted 30 April 2012 - 04:50 PM

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?

Want to get to know my work and I better? See my website: Au 79 Games

I wrote General Tips on the Process of Solo Game Development


Sponsor:

#2 Volgogradetzzz   Members   -  Reputation: 534

Like
0Likes
Like

Posted 01 May 2012 - 12:25 AM

What I need to figure out is how to detect which axis is best to resolve the collision.

In SAT it's axis with minimal projection overlaping.

#3 LorenzoGatti   Crossbones+   -  Reputation: 2525

Like
0Likes
Like

Posted 01 May 2012 - 03:43 AM

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.
Produci, consuma, crepa

#4 makuto   Members   -  Reputation: 828

Like
0Likes
Like

Posted 01 May 2012 - 07:23 AM

In SAT it's axis with minimal projection overlaping.

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.

Want to get to know my work and I better? See my website: Au 79 Games

I wrote General Tips on the Process of Solo Game Development


#5 Volgogradetzzz   Members   -  Reputation: 534

Like
0Likes
Like

Posted 01 May 2012 - 07:39 AM

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.

Then you definitelly need time prediction algorithm. The same SAT is good. I wrote a post long time ago - check it out
http://volgogradetzzz.blogspot.com/

#6 makuto   Members   -  Reputation: 828

Like
0Likes
Like

Posted 02 May 2012 - 06:36 AM

Great tutorial! It ws a little hard to read, but your English is pretty good. Thanks for the help!

Want to get to know my work and I better? See my website: Au 79 Games

I wrote General Tips on the Process of Solo Game Development





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS