How do I rotate a sprite to an angle linearly like if its to rotate from 0deg to 90deg I want to rotate linearly at a speed of 10 deg/sec

What do you mean by not lerping? Do you mean by using `add_torque`?

So you want to do a linear rotation that does not involve linear interpolation?

@Magso Its just a simple sprite not a Rigidbody2d so addtorque would not be present.
torque wont stop once it has reached the target angle in my case the globalmouseposition.

@Ertain yes I wanted to do a linear rotation like 90deg/sec or 75deg/sec towards the target angle and stop at target angle.

I finally got the solution for this problem. Took more than a day.

``````export var rotation_speed := 90.0
export var offset_angle := 0.0

func _process(delta):
var target_angle = get_global_mouse_position().angle_to_point(position) + offset_angle
if (rotation != target_angle):
var angle_dif = -short_angle_dist(rotation, target_angle)
if (abs(angle_dif) < 0.05f):
rotation = target_angle
else:
rotation = rotation - rotation_speed * delta * sign(angle_dif)

func short_angle_dist(from, to):
var max_angle = TAU
var difference = fmod(to - from, max_angle)
return fmod(2 * difference, max_angle) - difference
``````
answered Jul 5 by (75 points)