can i make limit of rotation by rotate_x function?

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

i can make limit of rotation by get_rotation_degree() and rotation.x propertie.
but i can not make it by rotate_x function.
can i do it?

var angle = 0
func _physics_process(delta):
if Input.is_key_pressed(KEY_A):
angle = clamp(angle + 0.01,0,PI/4)

i think rotate_x function for rotation amout.
it is not for rotation angle limit.

What is the type of your node?

BraindeadBZH | 2019-08-28 17:08

sorry,node type is kinematicbody!

bgegg | 2019-08-28 19:25

:bust_in_silhouette: Reply From: BraindeadBZH

I know this is not as elegant as a clamp but I would go with a if test instead.