I think I am using rotate function wrong

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

I am really newbie in godot, I copy pasted some code from online. The problem is I need to rotate the ball 180 degrees and go the way the ball is facing when the ball hits the bar, I think the ball is rotating but it is not going the way it is facing. I used the Vector2.()rotated function. I think I did something wrong in the Vector2.rotated function. If anyone know what I did wrong pls answer me.
drive image

File Download

:bust_in_silhouette: Reply From: jgodfrey

I don’t know the value of your rotation variable is in your code, but I’m guessing that you maybe set it to 180? If you did, that’s likely the problem as it expects the argument to be provided in radians.

In that case, you can use rotated(deg2rad(180))

1 Like

this helped me! Thank you