Hey, just wanted to say this module is really useful and performant. I’ve been integrating it into my project and its been a great improvement over manual overlap polling.
That said, I ran into something that I think is worth addressing. The documentation around ZoneItem and hitbox usage is a bit unclear, and I think theres a missing feature that would make the module a lot more practical.
Right now when :observe() fires, the callback only receives the item (player/model), but theres no way to know which specific shapeInstance triggered it, and more importantly, there’s no way to attach custom data to a shapeInstance. This becomes a real problem when you have multiple hitboxes with different properties, for example different enemies each with their own damage value.
To show what I mean:
local function attachEnemyHitbox(enemy: Model, damage: number)
local shapeInst = Zone.shapeInstance.new(hitboxShape)
shapeInst:syncWithAttachment(rootAttach)
shapeInst:attach(hitboxZone)
end
Inside :observe(), theres no way to reference which enemy or what damage value belongs to the shapeInstance that triggered the overlap. The enemy and damage variables are out of scope.
The workaround right now is creating a separate Zone and listener per hitbox, but that feels like it goes against the purpose of the module and probably has performance implications at scale
I think the cleanest solution would be adding a way to attach arbitrary data to a shapeInstance, something like:
shapeInst:setData({
damage = 5,
enemy = enemyModel,
hitbox = hitboxPart,
})
Then inside :observe(), that data would be accessible through the item or a second argument so you can handle per-hitbox logic without needing separate listeners. The table contents could be anything the user defines which keeps it flexible.
This would make the enemy hitbox use case (and many others like gas zones, damage areas etc.) work naturally with a single shared listener.
Looking forward to seeing where this goes, the core of the module is solid and just needs this one piece to be complete 