Circular collision detection with negative masks
I'm currently planning out a game engine which involves circular collision detection, largely because I appreciate the simplicity of it - calculate distance between objects, compare against the sum of their radii.
However, I'm seeing that there are cases where it would be useful to have negative collision masks, i.e., the intersection between them and whatever circle they are applied to does not register collisions.
Is there any reasonably simple way to do this?
In addition, it would be preferable (though not necessary) for such a method to be extendable to cover ellipses in general - I'm imagining that (not counting negative masks) checking ellipsis collisions is the same as with circles, but applying a factor to one or both radii according to their relative offset from the ellipsis/es' major axis.
Not that I am aware of, and I am pretty sure that adding those functionality will remove the simplicity.
The best way to find out those things is with compass, pencil and paper. Those pictures could also help to explain the problem.
What Quake does is use brushes, which are essentially convex blocks with each face represented by a plane equation. You can then test the point with each plane.
Python-ish pseudo code:
collision = true
for plane in brush.faces:
if plane.distance(point) > radius:
collision = false
I haven't really worked with ellipses before, but I read something about scaling along an axis. That's probably a good place to start.
EDIT: Fixed some typos
EDIT 2: Oh, I think I misread the OP. :/ But this is still some useful information to have around.