I just started with the BGE and am making a 2D mario-type scroller game. The level is long enough to require two cameras, so I made an invisible plane which on collision switches to the sexing camera. However, I also want to go back to the first camera. How do I switch back?
you could try to incorporate a property to go along with the plane. For example when your character hits the plane and the property is 0 set camera to camera1 then when character hits plane and property is 1 set camera to camera0
link to download blend click
Since this a general question about changing the camera in the BGE, I'd like to throw in a method using Python. The following screenshot shows an example where the camera is switched when the spacebar is pressed. It involves:
- two cameras (cObserver and cFollow)
- an object (LOGIC) carrying the script (nextCam)
- a script containing the camera list and simple logic
Think of a racing game with several cockpit-, follow- or even spectatorviews with keyframed camerashakes.
I personally prefer this method when the number of cameras increases, since it's easier to maintain than logic bricks. Additionally you can run additional logic depending on the active view, like changing the zoom level of the active cam with KX_Camera.lens.