Anyone solved the setCamera problem?

I’m trying to reduce my logic brick setup from having a separate brick for each camera, to having a single brick controlled by a script. However the setCamera() function seems to be broken. I know some of you have had problems with it before, but has anyone found a solution? My code looks like this:

if o.getPosition()[1] > -27.0:

		Camera = c.getActuator("Camera")
		Camera.setCamera(g.getCurrentScene().getObjectList()["OBR2 Camera1"])


		Camera = c.getActuator("Camera")
		Camera.setCamera(g.getCurrentScene().getObjectList()["OBR2 Camera2"])

Attached to a pulsing always sensor. I’ve tried using a string with the camera name, and also going through the scene module to get the cameras, but neither method works :frowning:

here is an example :

it needs a name in the set camera field

Yep, almost used the same way. 2 camera actuators, when 1 = pos, cam 1 = set, when 1 = neg, cam 2 = set (how it works)
Do’t use getobj list and use objects. I use python as controllers. That way you can do more with logic bricks :slight_smile: but I also got problem with it :frowning: I’ll post them later.

cont = GameLogic.getCurrentController()
own = cont.getOwner()

camera1 = cont.getActuator("camera1")
camera2 = cont.getActuator("camera2")
objects = cont.getSensor("object")

if objects.isPositive():
	GameLogic.addActiveActuator(camera2, 1)
	GameLogic.addActiveActuator(camera1, 0)
	GameLogic.addActiveActuator(camera1, 1)
	GameLogic.addActiveActuator(camera2, 0)