How to make a object rotate once using lerp

godot 4.2

Question

-so i got a problem i want to rotate a object one time from 0 to 1 without any further change to the value if the player keeps holding the button it always stays at 1 until the player releases the key after the player releases the key it goes to 0

heres come code i managed to do from 0 to 1 but it increases when the player holds the key down i dont want, want it to stay at 1 while the character is holding down the key any know a way around this thank you very much :slight_smile:

func Lean():
if Input.is_action_pressed(“A”):
rotate_z(deg_to_rad(lerp(0, 1,1)))

You can try using lerp_angle()

How do you do your input handling for detecting that the player pressed the key? If you use something like Input.is_action_just_pressed("your_action"), then it should only trigger once when the player presses the button down, and not while they’re holding it.

thats a valid solution

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.