Attention |
Topic was automatically imported from the old Question2Answer platform. | |

Asked By |
AsuosOnurb |

I’m using .get_rotation() to get the rotation value in radians of a Node2D node.

The problem I’m having is that after every rotation of the node, it’s rotation value keeps on going up/down.

Basically, I need a way to get the rotation to range between [0, 2PI] only, and not their multiples.

Maybe I need to get the rotation and then apply some math functions to get the [0, 2PI] equivalent but I don’t know how…

Can you include some information about how you’re rotating the object?

kidscancode | 2018-09-09 16:13

This is part that handles the rotation of the object (WeaponContainer = weapon): Imgur: The magic of the Internet

Im trying to make the weapon face the direction of the player’s movement. That part seems to work fine. The problem is in the if statements. I need some way to transform the current_angle variable into an angle 0º <= x <= 360º.

Thanks for your time!

AsuosOnurb | 2018-09-09 17:07