Changing cameras while going to another room doesnt work

Godot v4.3

I was making a game and I wanted to change camera
when I go to another room but it doesnt work

func current_camera():
if global.current_scene == “world”:
$Camera_World.enabled == true
$Camera_Road.enabled == false
elif global.current_scene == “road”:
$Camera_World.enabled == false
$Camera_Road.enabled == true

Just use:

camera_world.current = true

It automatically sets the world camera as current (switches to the world camera)
If you want to switch to the other camera you can do this:

camera_road.current = true

This explains it further:
https://forum.godotengine.org/t/how-to-switch-between-cameras-with-set-current/22584

1 Like

I am on godot 4 and theres no such a thing

Sorry it’s camera.make_current() enabled must be true on the camera.
At least that’s what the documentation says.

1 Like

it works but for some reason
its flipped but I am going to fix it

func current_camera():
if global.current_scene == “road”:
$Camera_World.make_current()
elif global.current_scene == “world”:
$Camera_Road.make_current()

THANK YOU I HAVE BEEN STUCK FOR A FEW HOURS :sob:

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