Fat, SAT, This and That

Posted by DesertFox on March 10, 2010, 5 p.m.

On the plane back to New York, I got put next to a fat guy. I hate fat people on planes, because the tend to 'spill over' into your seat. Lucky for me, I changed planes in Detroit, and this time, I got set next to a midget! It was awesome! Midgets are awesome! Sitting next to a midget is awesome!

Anyhow, I got bored and decided to implement the Separating Axis Theorem in C#. Here's my awesome result:

The blue box collides with all of the other shapes, including the curves, and it responds exactly how you think it should - which is kickass considering how many collision systems feel fake.

If you don't know what the Separating Axis Theorem is, I suggest you go here. Its not complicated. Basically, it says that for any two non-colliding convex polygons, there is an axis between them on which the two shapes have no overlap. This may sound obvious, and it is! But how is this useful? That axis could be in any direction! Well, you can simplify it if you realize that you only need to check the axes that are normal to the polygon's edges, like so:

See? It gets more complex, but that's the basic idea. The advantage of this type of collision system is that it is fast, and that when two objects are interpenetrating (colliding) the SAT algorithm not only tells you that they are, but it also tells you EXACTLY how far to shove an object, and in EXACTLY what direction, to resolve the collision properly. Its pretty awesome. I may post the code sometime.

Lets see, what else have I been doing? Hmmm…

I've:

-Bought and read The Collected Stories of Arthur C. Clarke (1000 pages of glorious awesome!)

-Been playing Jet Car Stunts

-Been watching Farscape (for arns and arns!)

-HERE BE DRAGONS

-Gotten addicted to beef jerky

-Also eaten lots of Mexican food

-Lost my favorite pair of shorts

-MORE DRAGONS

-Painted a small office for 100$USD

-Drank a quart of delicious cranberry juice

-Decided that Zuppa Toscana is the best soup in the world

-NOT A DRAGON

-Started some new classes

Aside from that, I don't know what else, other than BLARGH!

Comments

Juju 14 years, 7 months ago

Ooh clever beans.

Castypher 14 years, 7 months ago

What's with you and planes? You've sat next to fat people, midgets, been to hell and back…. You're quite adventurous, aren't you? Who said foxes can't fly?

Kaz 14 years, 7 months ago

Man if I had free time I'd learn C# more. Currently taking 6 classes and teaching 1. *sigh*

ATOGAMES 14 years, 7 months ago

I tried learning C#, Blew it away for java and flash.

I regret it everyday.

OL 14 years, 7 months ago

SAT is great, I used it in my physics engine.

flashback 14 years, 7 months ago

PREPARE FOR IMMEDIATE STARBURST!

sirxemic 14 years, 7 months ago

I thought SAT only works on convex shapes, and I clearly see some concave shapes in thar that* screenshot… :S?

Kaz 14 years, 7 months ago

Quote:
I thought SAT only works on convex shapes, and I clearly see some concave shapes in thar screenshot… :S?
I was curious about that too. What magic have you fooled us with?

DesertFox 14 years, 7 months ago

Actually, the only concave shape is the concave round - it's represented by an inverse curve.

Nah just kidding - it's

MAGIC!

Scott_AW 14 years, 7 months ago

That does sound awesome, I'll go check that out.