Try this:

```
func _physics_process(delta):
if Input.is_action_pressed("up"):
rd = 0
elif Input.is_action_pressed("down"):
rd = 180
elif Input.is_action_pressed("right"):
rd = 90
elif Input.is_action_pressed("left"):
rd = -90
rotation= lerp_angle(rotation, rd, 0.1)
```

`lerp_angle`

is similar to lerp, but interpolates correctly when the angles wrap around @GDScript.TAU. To perform eased interpolation with lerp_angle, combine it with ease or smoothstep.

Note: This function lerps through the shortest path between `from`

and `to`

. However, when these two angles are approximately `PI + k * TAU`

apart for any integer `k`

, it's not obvious which way they lerp due to floating-point precision errors. For example, `lerp_angle(0, PI, weight)`

lerps counter-clockwise, while `lerp_angle(0, PI + 5 * TAU, weight)`

lerps clockwise.