# Set Multiple Cameras as Active (Game Engine)?

I pretty much just want multiple camera views at the same time (like side by side), so I can get different views of the game.

Also, I can see things in one camera view that I can't in another. Imagine monitors in a security room and each monitor shows a different camera in the building... Anything like that?

(FYI: I'm on Linux, v2.76 64bit)

• Maybe "active" is not the best term to use here, since in Blender there can by definition be only one active object at a time. Good question though. – Mentalist Oct 11 '15 at 1:07
• I do not have a detailed explanation here, but I suggest to look for viewports: blender.org/api/blender_python_api_2_76_release/… – Monster Oct 12 '15 at 4:52

I didn't write this script but it seems to work, and I think I understand how it works. Script credit

from bge import logic, render
camList = logic.getCurrentScene().cameras

cont = logic.getCurrentController()
own = cont.owner
cam1 = camList[own['cam1']]
cam2 = camList[own['cam2']]

width = render.getWindowWidth()
height = render.getWindowHeight()

cam1.setViewport(0, 0, int(width/2), height)
cam2.setViewport(int(width/2), 0, width, height)

cam1.useViewport = True
cam2.useViewport = True


Now the object that's running this is a cube, and it's logic looks like this:

Notice the two string properties! These define the cameras that will be used. you can see them called in lines 6 & 7. Basically, the script designates the Viewport area of each camera to half the width of the screen, which is perfect for split screen while playing a game with a friend... Like, a really close friend, cause you'll probably have to share a chair. :)

DISCLAIMER!!!: I did not write the script included in this answer