Is it possible to do this in 2.6? I'm trying to dynamically create cameras. Looking around the API reference I found KX_Camera and Camera, but they have no constructors or factories, that work at least.

In 2.4 it seems that you could do it, as I believe they have .new() methods.


1 Answer 1


You could try this:

import bge

scene = bge.logic.getCurrentScene()
owner = bge.logic.getCurrentController().owner
cam = scene.addObject("Camera.001", owner , 0)

Note that the camera object needs to be on an inactive layer.

To set the active camera in the BGE:

bge.logic.getCurrentScene().active_camera = cam

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .