Camera frustum in 2.49 problems

I am trying to determine which objects are in the active cameras view during a frame, the problem is that the camera frustum does not seem to change when I move the camera.

I figured out that I can change the frustum by setting the cameras “projection_matrix” property, but I have no idea how to combine the available orientation, position and rotation information in order to calculate the correct projection matrix for a given camera, can someone please help me out here or point me to an easier way to calculate it?

Note that I am actually trying to work out the objects in frame for a RENDER task not for a game - are there any incompatibilities between the two I should be aware of in this case?

Thanks in advance.

Current code (minus bounding box calculations for objects)


import Blender
import GameLogic

scene = GameLogic.getCurrentScene()

activeCamera = scene.active_camera
objectsInFrame = []
objectsNotInFrame = []

for ob in scene.objects:
    if activeCamera.pointInsideFrustum(ob.worldposition):
        objectsInFrame.append(ob)
    else:
        objectsNotInFrame.append(ob)


I’m no expert in non-BGE python, but can you use GameLogic outside the GE (or the Blender module in the GE, whichever way you’re planning on using this)?

Blender and the BGE are two different thing. You can’t mix them.

What you can do is:

  • you can write the results of your “measurement” into a Blender data while running the BGE. This is similar to recording to IPO/F-Curves.