CustomCollisions is a module to manage collisions between projectiles with high customizability.
Due to the unreliability of the Touched signal and the query API in general when used to detect collisions between projectiles, where one of the object’s hitbox handlers detect the one it has collided to, and during that same frame the other hasn’t detected it yet, causing undesired behavior if both projectiles were supposed to break each other, this module was created. With this module, not only this problem is solved by registering a destroy function to each object, allowing the other object’s hitbox handler to destroy both itself and the other according to the custom destroy functions, but also giving a lot of customizability over collisions of projectiles.
Both of my games, Elemental Legacy and Bending Battlegrounds 2 use this module due to their unique combat where it’s of extreme importance that skills have unique and customizable collisions. A single projectile being able to break another changes the whole balancement of the combat, hence this module was made.
Any suggestions for quality of life, performance, readability, or even completely new functions, please comment!
It should support anchored projectiles too, which is why I said “projectiles [unanchored] and structures [anchored]”. In Bending Battlegrounds 2, there are many structures which the earth elementalists can create in the map. Those structures also have custom collisions so they aren’t overpowered defensive methods, they can be destroyed by other objects aswell.
I’ve recently recoded the module to a much better code since this was pretty old and I needed to use it again for a recent project. Several functions have changed. If anyone used this, please take a look at the new text both in the post and in the module. Here’s an example of my setup: