Controlling a camera with python scripting

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

strattonbrazil
Posts: 7
Joined: Wed Sep 06, 2006 4:36 pm

Controlling a camera with python scripting

Postby strattonbrazil » Fri Jul 27, 2012 6:01 am

If I'm in a controller for a non-camera object, is there an equivalent gluLookAt type function I could use to orient the active camera in the scene? Right now I've ignored the camera so when my game starts, it uses the same camera as the blender viewport. However, if I try to set the position, the screen goes blank when I start the game.

Code: Select all

scene = bge.logic.getCurrentScene()
camera = scene.active_camera
camera.position = [10,10,10]

Return to “Python”

Who is online

Users browsing this forum: No registered users and 2 guests