for the INSIDE property of KX_Camera, what is the sphere or box that is being tested? Thanks.
INSIDE, INTERSECT, and OUTSIDE are just class properties of the KX_Camera class that are returned by the sphereInsideFrustum and boxInsideFrustum methods. They are equal to the integers 0, 1, and 2 respectively. When calling these methods, you provide the location and size of the sphere/box to test.
Thanks Mobious. How would you use ‘INSIDE’ in code?
You’d only want to use them to check the result of the sphereInsideFrustum and boxInsideFrustum methods.
import bge scene = bge.logic.getCurrentScene() camera = scene.active_camera # check if sphere is inside or intersecting the camera frustum result = camera.sphereInsideFrustum([0, 0, 0], 1) if result == camera.INSIDE: print('sphere is inside frustum') elif result == camera.INTERSECT: print('sphere is intersecting frustum') else: print('sphere is outside frustum')
EDIT: A quick side note: I just did a test with the sphereInsideFrustum method, and it appears to return incorrect results when run on the first frame of the game engine. Running it after the first frame works fine though. This is probably a result of running the Python code before the camera’s frustum is initialized.
That’s exactly it, and should apply to every frustum operation