Godot has the distance_to
methods for Vector3
and Vector2
but what would be the best way to get the distance from a 3d node to a 2d node? For example, I'm looking to see how far away the 3d kinematic body is from a 2d text label.
Currently, I'm trying something like:
var player_global_origin = player.global_transform.origin
var player_vec2 = Vector2(player_global_origin.z, player_global_origin.x)
var distance_to_label = player_vec2.distance_to(label.get_global_transform().origin)
Which seems to work ok when just moving forwards and backwards but it feels like it's easy to break.