Skip to main content
GameDev.net gamedev.net
🔒 Locked

SAT test

Started by hick18 Sep 10, 2010 at 7:17 PM 0 replies 900+ views
Original Post
hick18
hick18
Im using SAT to test for 2D collisions. But I seem to be getting a lot of errors with my collision responce, where a lot of the time objects are passing through each other instead of the impulse causing them to bounce off each other.

I believe this is due to my SAT implementation. Ive noticed that Im not paying attention to which direction on the found axis with the smallest penetration im going to use as the collision normal.

For example, if i have 2 squares colliding, there is 4 axies, square ones x and y, and square twos x and y. However, this four axies can also be positive or negative.

When you've found the axis with the smallest penetration, how do you determine whether to use this axis in the positive direction or the negative direction?

i.e, if black is the axis with the smallest penetration, is the contact normal the red or the blue direction?

Image and video hosting by TinyPic

I assume Im also going to need to take into consideration the objects velocities. So I'd project A's velocity onto the axis, and get the direction thats most opposite to A's velocity?
relsoft
relsoft
Use a swept test by subtracting their velocities. Then project A's relative velocity to b to find how deep the penetration should be. Use that as your MTV.

http://imortisoft.no-ip.org/b2b/?Issue_%231:2D_Convex_Polygon_Collision_using_SAT
Hi.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.