You could insert it into the _input function, but I’m not sure why your current code wouldn’t work at the moment. Does it give you an error? is $TopCam already the current camera?
func _input(event: InputEvent) -> void:
if event.is_action_pressed("cam_switch"):
$TopCam.current = true
The problem was not that there was an error, it was that I was not able to switch between the Two Cameras using only One Hotkey.
This is my updated code so far.
extends Node3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _input(event: InputEvent) -> void:
if event.is_action_pressed("cam_switch"):
$TopCam.current = true
Yes. That did not work. Ignoring the Switch between cams from One Key for a sec. Let alone, I can not seem to make a switch with using two.
func _process(delta):
if Input.is_action_just_pressed("cam_switch01"):
$TopCam.set_current(true)
if Input.is_action_just_pressed("cam_switch02"):
$PlayerCam.set_current(true)
Attempt to call function ‘set_current’ in base ‘null instance’ on a null instance.
Awesome, so you will need $Player/Head/PlayerCam, or more if the Player is the child of anything else, in my example I had a Players Marker3D node to contain them
Have you tried setting the one that’s not your current camera’s .set_current() to false? If I could see your entire scene tree that might help me a little bit.