how do I enable and disable the interpolated camera by using a button?

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

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):
       if ($Camera.enable==false):

i added the print “changed” because i thought the button wasn’t working but it

:bust_in_silhouette: Reply From: kidscancode

The InterpolatedCamera property is called enabled:

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

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

Onyxgold | 2021-06-21 11:21