BGE API help - how to retrieve the active camera

Hi (first post please be gentle :wink: )

I am using the BGE to create a game that has multiple objects and multiple camera views.

I want to only move an object if the active camera is a child of that object.

I have a python controller for object movement. In this script I need to condition movement based on whether the object is the parent of the active camera.

My problem: I can’t find an instance variable or method in the API that tells me the current (active) camera.

Any ideas?

There are 2 ways of doing this…

eg. scene.active_camera = someCamera

All scene cameras

And for multiple active cameras…
viewport_cams = [c for c in scene.cameras if c.useViewport]

hi MoonlightSonata,

Since you’re just being with Blender python, you might find documentation on my site easier to understand.

link to the python variable active_camera

link to main index


Thank you both - so that’s where the active camera instance is !

I also didn’t know you could have multiple active cameras - more than one view being rendered at the same time. - is this what you are saying ideasman ?