Get Vector2 direction for the move() function from a deg angle between two points

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By blurymind
:warning: Old Version Published before Godot 3 was released.

Basically I want to use an angle degrees float value that I got from the angle between two points in order to move a kinematic body with the move() function.

The Move function however takes a Vector2(x,y) value for the direction of movement

What I want to ask is - how the hell do I turn my angle degrees float value to a Vector2(x,y) value to be used by the move function?

:bust_in_silhouette: Reply From: YeOldeDM

You can get the direction vector by subtracting the second point from the first. You can then normalize the vector and multiply it by your speed (and delta assuming you’re doing this in _fixed_process).

var direction = ( target.get_pos() - self.get_pos() ).normalized()

That did it! Thank you!

blurymind | 2017-08-15 13:09