Material Box

Material Box

WEB Design & Material Images

Godot - Get distance between two nodes

Godot

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)

Godot

TitleGodot - Get distance between two nodes

CategoryGodot

Created

Update

AuthorYousuke.U