1

I have the following code in my Blender game:

if bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.QKEY]:   
    bpy.context.scene.camera = bpy.data.objects["Camera.Shoulder"]

My camera IS reset to 'Camera.Shoulder' but the view is not changed unless I exit and reenter a scene. Is there a way to rerender the scene using the new active camera during the game without using a logic brick (I want everything in Python.)

Ann Non
  • 11
  • 1

1 Answers1

1

The correct code should be:

if bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.QKEY]:   
    bge.logic.getCurrentScene().active_camera  = bge.logic.getCurrentScene().objects["Camera.Player"]

bge is for game engine logic, don't know why bpy doesn't work.

Matt
  • 11
  • 1