Topic: changeCurrentCamera help

So i'm trying to get the camera on my player to change when a certain key is pressed. I have 2 cameras set up on it, Camera0 and Camera1.
    if isKeyPressed("C") then
    changeCurrentCamera(Camera1)
    end
I'm new to lua so i'm not sure why this code won't work.

Re: changeCurrentCamera help

did you declare the objects with getObject ?

-- get objects
Camera1 = getObject("Camera1")
Camera2 = getObject("Camera2")

-- scene update
function onSceneUpdate()

    if onKeyDown("B") then
         changeCurrentCamera(Camera2)
    elseif onKeyDown("C") then
         changeCurrentCamera(Camera1)
    end

end

Re: changeCurrentCamera help

This worked! Thanks for the help.