10 - Changing Cameras

Making it

Changing cameras can be used in creating cutscens, changing views, etc. First things first, fire up BGE and open up logic editor.

Creating cameras in the scene

Having the 3D viewport opened (its open by default lol), add some cameras like 2 - 3. Don't forget to rename your camera to whatver name you want so you know that it is the main one. I'll 3 cameras and keep them in different positions and angles. Something like this.

3 Cameras in the scene
Creating the logic

Now dive into logic editor and select your main camera if you haven't selected. Add 3 Keyboard sensors and 3 Scene actuators. Press 1,2 and 3 for the three keyboard sensors respectively. Change the Mode of all Scene actuators, from Restart to Set Camera so that we can switch between cameras by pressing the 1,2,3 keys on the keyboard.

Connect the sensors to the actuators, 1st sensor to 1st actuator, 2nd one to 2nd, and 3rd one to 3rd like this.

Example setup of camera switching

Run the game and nice if it works. Doesn't work, continue to read to find solutions.

Download the project file.

Common problems and fixes

for Laptop Users

If you are a laptop user and don't have Numpad on your keyboard, you'll find a red colored Fn key on it. And on your QWERTY keys, you'll find some red colored numbers, special characters on it and some icons on Function Keys.

Numpad numbers in laptop keyboard

Press the Fn key and press the letters which has numbers on it. That should work. This happens when users who don't have numpad on their keyboard may have Emulate Numpad turned on in Blender User Preferences.

Emulate Numpad option turned on

Happy learning!