what is the direction_to method for?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lalel345

I’ve been testing this vector2 method and I don’t see any changes and don’t know how to use it.
can someone explain to me what its function is

:bust_in_silhouette: Reply From: p7f

As the docs say here That method retunrs a vector with length 1 that points to the Vector in the argument. For example:

var start = Vector2(3,4)
var end = Vector2(5,5)

var direction = start.direction_to(end)
# will print (0.894427, 0.447214), as it is the normalized vector  
# that points to `end` vector, starting from `start` vector.

print(direction)