` I have maked a script of the RigidBody2D have a constant velocity and can rotate facing the mouse. But when it runs, the rotation seems like be locked in a range.
heres the code:
extends RigidBody2D
func _ready() → void:
pass
func _process(delta: float) → void:
linear_velocity = Vector2(10, 0)
rotation = rotate_toward(rotation, (get_global_mouse_position() - position).angle(), delta * 8)
Do you get the same result if you try it on something that isn’t a RigidBody?
It might be be because RigidBodies aren’t supposed to have their position and rotation updated directly. There’s some information about in the docs (Using RigidBody — Godot Engine (stable) documentation in English) and, to my surprise, an example that I think might be a solution to your exact problem!