Godot - Get distance between two nodes
This is how to get the distance between two nodes using GDScript in Godot 4.
You can get the distance between two nodes using distance_to()
.distance_to()
has the following characteristics:
- Specify the position of the target node as an argument
- position, global_position can be specified
var distance = global_position.distance_to(target.global_position)