GoHitHurt
A small Godot addon for building hit/hurtbox interactions with plain scene composition, in both 2D and 3D.
GoHitHurt provides a matched pair of nodes - a hitbox that scans for targets and a hurtbox that receives hits - that report collisions through signals and pass arbitrary data along with each hit, all configured from the inspector.
đ¤ Why use GoHitHurt?
If you find yourself hand-rolling Area2D/Area3D overlap plumbing for every attack, projectile, and damageable body, this addon moves that logic into a couple of reusable, drop-in nodes.
It is especially useful when you want:
- consistent hit detection across many entities
- attacks that carry their own data (damage, knockback, status effects)
- toggling hitboxes on and off per animation frame or attack window
- the same workflow in 2D and 3D
- collision behavior configured in scenes rather than in many custom scripts
⨠What it includes
GoHitbox2D/GoHitbox3D- scan for hurtboxes each physics frame (
ShapeCast2Din 2D) - emit
hit_detectedand notify each hurtbox on contact - carry a
hit_datadictionary merged into every reported collision - throttle scanning with
frame_delay - enable, disable, or toggle for a fixed duration
- trigger a manual query on demand with
query_hit()
- scan for hurtboxes each physics frame (
GoHurtbox2D/GoHurtbox3D- passive, detectable regions that receive hits from a hitbox
- re-emit incoming hits through
hit_detectedfor game code to consume - enable, disable, or toggle for a fixed duration
đ§ How it works
Hitboxes and hurtboxes play complementary roles:
- A hitbox is active. It scans its shape against the physics space and, for every overlapping hurtbox, emits
hit_detectedand calls the hurtbox'sreceive_hit(). Non-hurtbox colliders are added as exceptions so they are skipped on later scans. - A hurtbox is passive. It performs no scanning of its own â it is monitorable so a hitbox can find it, and it reacts only when a hitbox hands it a hit, re-emitting the collision through its own
hit_detectedsignal.
When a hit lands, the hitbox's hit_data is merged into the collision dictionary along with a source key pointing back at the hitbox, so a single dictionary carries everything a listener needs.
âď¸ Installation
- Copy the
addons/gohithurtfolder into your Godot project. - Open
Project > Project Settings > Plugins. - Enable
GoHitHurt.
đ Getting started
Set up a hurtbox
- Add a
GoHurtbox2D(orGoHurtbox3D) node to the entity that can be hit. - Give it a
CollisionShape2D/CollisionShape3Dchild. - Connect its
hit_detectedsignal to your damage/health logic.
Set up a hitbox
- Add a
GoHitbox2D(orGoHitbox3D) node to the attacker. - Give it a collision shape covering the attack's reach.
- Fill in
hit_datafrom the inspector (for example{ "damage": 10 }). - Enable it during the active frames of your attack.
When the hitbox overlaps a hurtbox, the hurtbox's hit_detected fires with the merged collision data.
Time an attack window
Use enable_temporarily() to open the hitbox for a fixed duration, or enable() / disable() to gate it against animation frames:
$GoHitbox2D.enable_temporarily(0.2)
Poll on demand
Call query_hit() to run a single scan this frame regardless of the hitbox's enabled state â handy for instantaneous checks driven by code rather than the per-frame loop.
đĄ Use cases
- melee attacks with per-frame active windows
- projectiles that deal damage on contact
- environmental hazards (spikes, lava, traps)
- passing damage, knockback, or status effects with each hit
- momentarily invulnerable targets by disabling a hurtbox
- code-driven hit checks via
query_hit()
đ Notes
- A hurtbox does nothing on its own until a hitbox hands it a hit.
frame_delayon a hitbox must be>= 1.query_hit()bypasses the hitbox's enabled state, but a disabled hurtbox still ignores the hit.- A disabled hurtbox remains detectable; the hit is simply ignored on arrival rather than prevented at the shape-cast level.
- The 2D and 3D variants share the same API, pick the pair that matches your game.
đ¤ Contributing
If you want to add features, improve documentation, or suggest enhancements, please open an issue. Feedback is welcome and appreciated!
Changelog for version GoHitHurt v.1.0
No changelog provided for this version.