#Character not rotating

7 messages · Page 1 of 1 (latest)

karmic silo
#

it rotates normally when I press "move_left", but it doesn't work when I press "move_right", and for some reason everything works just fine when I set the number to 9.5 instead of 9.4

if Input.is_action_just_pressed("move_left"):
        if $Animations.rotation.y == 0:
            $Animations.rotation.y += 9.4
            
    if Input.is_action_just_pressed("move_right"):
        if $Animations.rotation.y == 9.4:
            $Animations.rotation.y -= 9.4
feral pagoda
karmic silo
#

I didn’t even think of setting it

#

I just tried setting it but it still isn't working, did I do the is_equal_approx() thing right?

if Input.is_action_just_pressed("move_left"):
        if $Animations.rotation.y.is_equal_approx(0):
            $Animations.rotation.y = 9.4
            
    if Input.is_action_just_pressed("move_right"):
        if $Animations.rotation.y.is_equal_approx(9.4):
            $Animations.rotation.y = 0
#

it's saying in the output-
Invalid call. Nonexistent function 'is_equal_approx' in base 'float'.

reef nacelle
#

I think you do is_equal_approx(a, b) to compare two floats

karmic silo
#

Ok I got it fixed