Collision with and without AABB #2 Group 12

Hello readers!, today I’ll be speaking about Axis-Aligned Bounding Box, Circular Collision aswell as the Seperate Axis Theorem, so lets get right at it!, the reason I’ve worked on collision is because my group has been preparing for the official date of our alpha, which is 19/02/16 and due to this I’ve finally included a collision system into the game.

So you might ask yourself, “why do you need to go through three different collision systems when you only need one?” well the answer to this is rather simple, you need to know and understand all three of theese systems to understand which one is fitting for your needs and expectations.

Let’s start with the Basic Axis-Aligned Bound Box, it’s a rather uncomplex system where you’ve got rectangles or cubes following the predetermined x- and y- axis, making a update check where it checks if the distance between box A and box B is equal to or less than the length and if this value (which we call a bool, true or false value) turns out to be true, then happy times you’ve got a collision, which makes this system perfect for static objects that doesn’t rotate.

Now for the more “interesting” things depending on who you’re asking of course, let me aid you with some Visual ques to ease my explaining of this part of the blog.Seperate Axis Theorem
So like you can see we’ll be starting with Circle Collision and we’ll be saving Seperate Axis Theorem, when I’m done with Circle Collision.

So let’s go back to a earlier question as of “Why?”, well unlike squares, circles are round (obviously) and they make for a great makeshift hitbox if you’ve got a rotating object and/or have a round or if you got a round-ish object then you can make the hitbox slightly larger or smaller depending on your individual needs.

Follow-up question which is obviously “How?”, well it isn’t as complicated as one would think, it’s “simply” you take the Circle’s radius and check if it’s larger than the distance between the two circles using very fundamental Pythagorean Theorem, this gives you the distance between the two circles which can be compared to the circle’s combined Pi, giving you another (bool) true or false, giving you yet again another form of Collision.

Now we’ve left the leight weights and dived deeper down into some of the more heavy hitter’s in programming such as Seperate Axis Theorem or SAT for short, you’re already maybe thinking to yourself “why would I need this” and my answer is simple and short, imagine a rotating cube or a rotating Octagon, yes my fellow readers this is what graphic designers want and this is what programmer’s dread.

So back to the simple statement “How?!?!?!” well just as you’ve might noticed, it doesn’t get much more difficulty programming it, just turns into more math for every step(Circle collision requires CMath.h (an extra library of math functions) to even work and so does this), well in the future we’re planning to add this into our rendition of Collossus Core at the moment we’ve only got a Circle collision as a mock-up place holder, but let me explain the fundamentals of it.

The SAT (Seperate Axis Theorem) states that if you’re able to draw a line between to seperate figures then they’re not colliding, it sounds very easy because the idea behind it is however what it ends up beeing for a programmer is different, I won’t go into depths with it but to give you something to look at!.octagon
So what you can get a brief understanding how it works so imagine a line going straight along the edges and out the tips following the shape perfectly this allows you to check if you can draw all the lines available and if you can’t, then you might’ve guessed it you’ve got a collision and the best part of this shape is not only can you have very fun and entertaining shapes you can also have it totally seperated from your Axis so you can have this shape spin around and you’ve still got a perfect functioning and correct hitbox.

If you’re curious and want to find out more about anyone of theese methods of collision detecing feel free, the internet is big and lots of people giving you in depth in descriptions code-wise how to perform any of theese tasks, that’s all for me, thanks for reading this blogg post and I hope to see you next time!.

About Peter Ericson

2015 Programming