# SAT and then what?

I am on my way to make another Arkanoid game but this time I decided that I want it a little bit more realistic than just checking intersections between AABB and inverting one vector's component on collision.

So I found SAT but I don't know how can I change direction of the ball in realistic matter. Maybe I'm wrong but it seems like knowing MTV doesn't give me much.

So my question is what algorithms should I use to make it realistic? I also care about possibility of spinning ball with a pallet. I don't know how to do it exactly but I guess I will need to consider acceleration of the pallet.

-
do you want realistic collisions, or realistic physics. there is a slight trade off between the 2. – gardian06 Apr 21 '12 at 21:03
@gardian06 honestly I thought these two do not exclude each other. Could you elaborate on those? – Marek Apr 21 '12 at 21:48
What are SATs? I assume AABB = axis-aligned bounded box – ashes999 Apr 21 '12 at 22:11
@ashes999 SAT stands for Separating Axes Theorem and it just says that if you can find an axis onto which projected figures does not overlap then there is no collision. There is more of course. I found those two resources helpful sevenson.com.au/actionscript/sat and metanetsoftware.com/technique/tutorialA.html – Marek Apr 21 '12 at 22:46
usually to talk about realistic physics we have to talk about surface resistance, and deformations that can cause the need for a lot of extra collision data that can be ignored, and can lower performance. though realistic collisions are more pure math calcs – gardian06 Apr 21 '12 at 23:32

Using SAT for AABBs is an overkill, though it doesn't hurt to learn it, i guess.

I don't know what you're looking for. From SAT you'll have a vector that's a normal to the surface you're bouncing of off, all you have to do is calculate your new speed vector based on it, it's not complicated. I can tell you how i calculate it, but where's the fun in that?

After that if you want to calculate, i guess, "bounciness" of the surface or the ball, you add a vector that's perpendicular to the surface. If you want to add some friction then you can add annother vector, but this time one that's pararell to the surface. For a "spin", again you're adding a vector that's pararel to the pad, for a breakout game, depending on what part of the pad the ball landed on. So you check collision with the pad, you check what part it is, it can be regions, it can be % based, whatever you like, and you just add a vector, increse or decrese the speed probably, just put a limit on this so the player can't screw himself over. Giving you numbers won't help, you have to experiment alot with "simple" models like these.

For more complicated calculations you'll need a physics book and a realistic model probably.

-
what do you mean that SAT for AABB is overkill sounds more like original usage to me then overkill, and whats this bout needing a second vector for rotation. the parallel component becomes inverted for refraction, and the perpendicular becomes the rotation this also limits the transition from one to the other, and thats even how you model pool – gardian06 Apr 21 '12 at 21:10
what's so original about it, who said anything about a second vector for rotation, what rotation, what are you talking about, this comment makes little sense, are you talking about the surface normal, you're talking about the "pararell component", well how are you going to get it, check the side that was hit? no, you have it already, it's stored in the surface normal that you got from the algorithm, i've no idea what are you trying to say, i guess you're expecting his game to be axis aligned, he said he wants "something more this time" – dreta Apr 21 '12 at 21:18
@dreta so I take that normalized vector n from MTV and apply something like this: v-2(v•n)n where v is velocity vector. Is that what you said could tell me? – Marek Apr 21 '12 at 21:44
@dreta also about doing those friction, spin, 'bounciness' in a way you said... does it gives realistic, good looking results? – Marek Apr 21 '12 at 21:47
@Marek your equation seems like it's working, i'd code it and do more testing, as for the other factors, i guess they look realistic enough, it's just a simple model model, it'll need tweaking, what matters is that it's very simple to implement and control, so you can easily decide if this is what you want and if it gives you te resaults you want, as for the MTV, you have a normalized surface normal from the algoritm already, normalizing the MTV is an unnecessary calculation. – dreta Apr 22 '12 at 11:40