How to set an object to continuosly rotate

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

I tried:

set_rot(rad2deg(30)) # also tried multiplying rad2deg() with delta

But it doesn’t work, it moves upwards and only rotates once

:bust_in_silhouette: Reply From: kidscancode

set_rot() just sets the rotation to a value. Your code would just repeatedly set it to 30 degrees. To rotate, you need to alter it over time.

I’m assuming you’re using Godot 2.1. Try putting this in your _process():

var rot_speed = rad2deg(30)  # 30 deg/sec
set_rot(get_rot() + rot_speed * delta)

Thanks it works! But it moves too fast even when i set it to 1

Dava | 2018-03-21 19:36

There’s another problem, the object rotates, but it doesn’t move at all the move_local_x() doesn’t move the object while it is rotating

Dava | 2018-03-22 07:57