I’m making a game, and basically the character will have several sort of actions that require a hitbox, now the problem is I’m wondering whether I should have a main constantly running hitbox and then I just use that for everything or if I should handle each ‘action’ that uses a hitbox with it’s own separate hitbox class/module or something like that. My main questions are which one is more perfomant? Which one will be less of a hassle and more ideal for a big project?
For context: One of my hitboxes needs to be constantly running, and the other two will need to run some times.
Spatial queries are accelerated, but they are still not necessarily the fastest operations. A few don’t matter but in general if you don’t need to run something and it’s not hard to not run it, then don’t bother.
My hitbox module I create a hitbox then I can call :Activate() :Deactivate() on it and I do so based on animation events. For my melee attack system I get like a swing = “mainhitbox” which I use to go hitboxes[name]:Activate() and an endswing for deactivation. That’s how I go about it anyways. It also let’s me keep the hitbox connections for when it hits something always active since it will only report when it’s active.