how to rotate vector2

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

so i need to rotate the vector2 with the node or at least make it local (local x and y), is there any way to do that? i didnt found anything and manual and just rotating node keeps vector2 the same. Thank you

It’s hard to tell what you are trying to do. Do you mind sharing the relevant code.

magicalogic | 2022-12-10 15:54

this.

vania23 | 2022-12-10 17:33

:bust_in_silhouette: Reply From: aXu_AP

To rotate a Vector2 90 degrees (without deg2rad() specify your rotation in radians):

vec = vec.rotate(deg2rad(90))

To transform coordinates from global to local coordinates:

vec = to_local(vec)