This might have already been asked but how do I switch cameras in blender game engine? What I would like is to play a camera sequence perhaps a panning view around a map and then towards the end switch to a camera linked to my player modal for a third person setup.
The scene actuator allows you to alter the active camera.
As @sambler answer you can use a scene actuator. Also you can do it with a script.
from bge import logic locPoint = scene.objects['EmptyPanningEnd'].worldPosition scene = logic.getCurrentScene() cam1 = scene.objects['panningCamera'] cam2 = scene.objects['playerCamera'] if locPoint != cam1.worldPosition: scene.active_camera = cam1 else: scene.active_camera = cam2
Also if you want to change the camera pressing a key and you have a lot of cameras, add a property and named camera (in each camera).
from bge import logic own = logic.getCurrentController().owner scene = logic.getCurrentScene() camList = [cam for cam in scene.objects if 'camera' in cam.getPropertyNames()] if logic.keyboard.events[events.CKEY] == logic.KX_INPUT_JUST_ACTIVATED: change_camera(scene,camList) def change_camera(scene, camList): if camList.index(scene.active_camera) < (len(camList) -1): scene.active_camera = camList[camList.index(scene.active_camera) + 1] else: scene.active_camera = camList