Compare the distance on the ground, x and z only, with the circle's radius, and check height on its own. distance_to() includes height: in our Godot 4.7 test a character 2.9 m from the centre of a 3 m circle, with its origin 1 m above the ground, was 3.07 m away by distance_to() and counted as outside. Of three targets standing inside the circle, distance_to() found 1 and the script below found all 3.
The code
Put this node at the centre of your telegraph circle, on the ground, with radius set to the size the player sees. Add your enemies or players to the hittable group and call targets_hit() at the moment the attack lands.
extends Node3D
## Finds who is inside a round attack warning on the ground, measured flat on the ground.
## Put this at the centre of your telegraph circle and call targets_hit() at the moment the attack lands.
@export var radius := 3.0 ## the same radius as the circle the player sees
@export var group := "hittable"
@export var max_height := 3.0 ## ignore targets further than this above or below the circle
func is_inside(p: Vector3) -> bool:
var flat := Vector2(p.x - global_position.x, p.z - global_position.z) # height is left out
return flat.length() <= radius and absf(p.y - global_position.y) <= max_height
func targets_hit() -> Array[Node3D]:
var out: Array[Node3D] = []
for n in get_tree().get_nodes_in_group(group):
var t := n as Node3D
if t and is_inside(t.global_position):
out.append(t)
return out
What we measured
A circle with a 3 m radius on the ground at the origin.
- Inside, near the edge: 2.90 m from the centre on the ground, origin 1 m up.
distance_to()3.07 m, missed. Script: hit. - Near the centre: 2.00 m on the ground, origin 1 m up.
distance_to()2.24 m, hit. Script: hit. - A tall enemy with its origin 2 m up, 2.50 m from the centre:
distance_to()3.20 m, missed. Script: hit. - Outside: 3.20 m on the ground. Both missed.
- A flyer 6 m up, 1.00 m from the centre on the ground: both missed. The script skips it because of
max_height, 3 m.
Two runs gave the same numbers.
Why distance_to misses people standing in the circle
The circle the player sees is flat on the ground, but a character's origin is usually in its body, often a metre or more up. distance_to() measures the straight line in 3D, so the height adds to the distance and pushes characters near the edge, and tall ones, outside a circle they are clearly standing in. Leaving height out matches what the player sees. The separate height check keeps a flyer high above the circle, or someone on the floor above, from being hit.
What to change
radius: keep it equal to the circle you draw, or the player learns not to trust it.max_height: lower it in a building with floors close together.- To hit a character as soon as the edge of the circle touches its body, add the character's own radius to
radius. - Skillshot lines and slam rectangles that turn with the boss: check them in the attack's own space.
Ready-made telegraphs: AoE Telegraphs for Godot 4 has 35 attack warning indicators for boss fights, MOBAs and action RPGs: circles, a meteor target, donuts, cones, skillshot lines, crosses and a checker floor. They fill up and send a triggered signal at the exact moment to apply damage. Flat meshes, not decals, so they work in Compatibility and web exports.
Tested in Godot 4.7 with the Compatibility renderer.
Ready-made: AoE Telegraphs for Godot 4 has 35 ready-made attack warning indicators for boss fights, MOBAs and action RPGs, with a triggered signal at the exact moment to apply damage.
More how-tos for AoE Telegraphs for Godot 4: Particle ring standing up instead of flat
More how-tos: Hazards, traps and attacks
- Turn a 2D character left without the flicker
- A line or rectangle attack that hits what the player sees
- A scare that plays once, and only for the player
- An attack that hits even when a frame is slow
- Growing one cloud or aura zone grows all of them
- A parry window that is the same length on every screen
- A pair of portals that sends you through once
- An expanding shockwave that hits each enemy once
- Explosion damage that walls block, on the frame it goes off
- A fire or poison zone that keeps hurting while you stand in it
- A spike trap that hits whoever is already standing on it
- Block only attacks from the front
- A sword hitbox that hits each enemy once per swing
- Slows and roots that overlap
- Blink forward without going into or through walls
- Knockback that the walk code does not cancel
- Random spots spread evenly inside a circle
- Keep a pressure plate down while anything is still on it
- Refill the guard meter only after the hits stop
- Heal from the damage that actually landed
- Let the shield take what it can and pass the rest of the hit to health
- A saw blade that slides along its path at a steady speed
- Explosion damage that reaches big enemies
- A spinning laser that hits everything it sweeps over