Topic was automatically imported from the old Question2Answer platform.
Asked By
MaxDeveloper
hello, I’m working on the “enemy” code using an Area2d and I would like to know how I could transform the value of a Vector2 () into a number so that it can be assigned in the rotation property? … or if there is a specific method for this will also be of great help.
I think you mean you want to find the angle of a vector, which is what you would need to put in the rotation. You can get that with vector.angle(). For example, if you have a velocity vector for your movement, you could rotate to match that vector’s angle with
rotation = velocity.angle()
thank you very much! that was exactly what I needed