What collision detection are you using ?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
wazoowazoo
Prole
Posts: 16
Joined: Sun Jan 22, 2017 2:47 pm

What collision detection are you using ?

Post by wazoowazoo »

Hello everybody,

I am curious to know what collision detection algorithm you are using. Is it simply AABB ? Or maybe you are using SAT ? Or even JGK ? Another one maybe ?
And if you are using a library, could you tell me (if you know it) what collision detection algorithm it uses ?

It would also be interesting to know in what context you are using this algorithm and it's upsides and downsides.

Thank you for taking the time to answer my question ! :awesome:
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: What collision detection are you using ?

Post by pgimeno »

wazoowazoo wrote: Thu Aug 08, 2019 7:59 am Hello everybody,

I am curious to know what collision detection algorithm you are using. Is it simply AABB ? Or maybe you are using SAT ? Or even JGK ? Another one maybe ?
And if you are using a library, could you tell me (if you know it) what collision detection algorithm it uses ?

It would also be interesting to know in what context you are using this algorithm and it's upsides and downsides.

Thank you for taking the time to answer my question ! :awesome:
That question is not very well formulated. AABB is not a collision detection algorithm, it's a collision shape. AABB rectangle intersection is a collision detection algorithm, a particular application of the SAT (it checks for the four separating axes), and SAT in turn isn't an algorithm, it's a theorem.

You don't mention collision response, only collision detection, so I'll only comment on that aspect.

In Thrust II Reloaded I implemented pixel-perfect collision detection using a canvas, because I didn't need collision response: you collide, you crash. The upside is that, well, it's pixel-perfect. One downside is that it needs to be done with a very small canvas in order to check whether there was a collision or not, because every pixel needs to be checked. Drawing to this canvas reduces the FPS, but it's still playable on low-end machines. I had trouble with memory too and had to give a hand to the garbage collector.

For MazezaM (distributed with LIKO-12 now) movement is grid-aligned (except for the animation between squares, but that's a visual effect), so the collision check merely consist of checking if the next grid cell is occupied. When your game is designed with grid-aligned movement, it's probably the simplest.

I have used Bump, but not for anything I've made public. It uses AABBs as collision shapes. The author has commented on the algorithm several times, e.g. here: https://love2d.org/forums/viewtopic.php?t=11951. Minkowski difference simplifies collision response, as you only have to check a collision between a point and a polygon, rather than between two polygons, which is easier to work with. By the way, GJK is also based on the Minkowski difference, but it's used to calculate a distance with an iterative method; Bump uses MD differently.
Post Reply

Who is online

Users browsing this forum: No registered users and 107 guests