HitScan3D - cluttered-code/godot-health-hitbox-hurtbox GitHub Wiki

inspector

inherits: RayCast3D

Detects HurtBox3D components to automatically apply damage or healing.

Description

Detects HurtBox3D components to automatically apply damage or healing. Can also detect collisions with HitBox3D components.

hurt_box_entered, hit_box_entered, and action_applied signals are provided to enable complex interactions.

[!warning] The Collison Mask needs to be set so HurtBox3D and HitBox3D collisions can be detect.

[!warning] Collisions with HitBox3D are asymmetric, they can only be detected from HitScan3D. Interactions will have to be initiated from this component.

Tutorials

Properties

type name default
Health.Action action DAMAGE
int amount 1

Signals

hit_box_entered

signal hit_box_entered(hit_box: HitBox3D)

Emitted when colliding with a HitBox3D. Useful for interactions between projectiles.

  • hit_box is the other HitBox3D being collided with.

hurt_box_entered

signal hurt_box_entered(hurt_box: HurtBox3D)

Emitted when colliding with a HurtBox3D. Will apply DAMAGE or HEAL to HurtBox3D after emitting.

  • hurt_box is the HurtBox3D being collided with.

action_applied

signal action_applied(hurt_box: HurtBox3D)

Emitted after DAMAGE or HEAL is applied to HurtBox3D.

  • hurt_box is the HurtBox3D the action was applied to.

unknown_area_entered

signal unknown_area_entered(area: Area3D)

Emitted when colliding with an Area3D that isn't a HurtBox3D or another HitBox3D.

  • area is the Area3D being collided with.

Property Descriptions

action

@export var action: Health.Action = Health.Action.DAMAGE

The Health.Action to perfrom on the affected Health component.

amount

@export var amount: int = 1

The amount of the Health.Action to perfrom on the affected Health component.

Method Descriptions

fire

func fire() -> void

Performs get_collider() to determine if any HurtBox3D or HitBox3D components are being collied with. Appropriate signals will be sent and DAMAGE or HEAL applied to HurtBox3D.