0 votes

I'm trying to enable and disable the interpolated camera using a button.
i made a spatial(camera view) and made both the int. camera(cam) and button a child of the spatial. I gave the script to the spatial and in the script i connected the button to the script:

          func _on_Button_pressed():
            print "changed"
        if ($cam.enable==true):
        $cam.enable=false
       if ($Camera.enable==false):
        $Camera.enable=true

i added the print "changed" because i thought the button wasn't working but it

Godot version 3.2.3
in Engine by (12 points)

1 Answer

0 votes

The InterpolatedCamera property is called enabled:

https://docs.godotengine.org/en/stable/classes/class_interpolatedcamera.html

And if all you want to do is toggle it, you don't need so many ifs:

func _on_Button_pressed():
    $cam.enabled = not $cam.enabled
by (20,677 points)

Thanks for your answer I really appreciate it but it's still not working

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.