#Godot3 2d Problem with rotation degrees -> Vector2

7 messages · Page 1 of 1 (latest)

nova mesa
#

I am trying to make an arrow rotate around my player, which I also did in another project some months ago (lost it now). But for some reason, it doesn't matter what method I try to use to convert the angle to a Vector2 (I tried the cos() sin() as you can see in the code, but I also tried .rotated()), it won't work. What I have noticed this time, by printing out the Vector, is that for some reason every few degrees (like every 2-3 degrees) it changes from negative to positive, etc.

When I tried doing it with the .rotated() method, I had a similar problem. I tried direction.RIGHT.rotated(angle), and it worked quarter of the time, but the other few times it didn't and I had to change it to LEFT, DOWN or UP and it also worked only once, but I think that it may have something to do with the fact that for some reason the converted angle changes from positive number to negative number?

Also, I printed the rotation_degrees earlier and they were alright

restive tapir
#

Godot uses radians by default, so you'll need to convert to radians (or just use .rotation, which is already in radians)

nova mesa
restive tapir
#

If you're using 4.0 it got renamed to deg_to_rad

nova mesa
#

I am using 3.5

#

Maybe I put it in the wrong place? It's been a while since I've used deg2rad. I have to put it after .rotation_degrees, right?

restive tapir
#

Pretty sure deg2rad takes a number in, and returns the radians form. So it would be deg2rad($Arrow.rotation_degrees)