boxInsideFrusturm(box)
Tests the given box against the view frustum
Note:
box is an array of box's
corner positions. Uses world coordinates.
Returns: INSIDE, OUTSIDE or INTERSECT
box:
Type: a
matrix (float values)
# get the current scene
scene = GameLogic.getCurrentScene()
# get the active camera
cam = scene.active_camera
################ Box to test
# create an empty array
box = [ ]
# enter the position of the corner vertices (world
coordinates)
box.append([ -1.0, -1.0, -1.0])
box.append([ -1.0, -1.0, 1.0])
box.append([ -1.0, 1.0, -1.0])
box.append([ -1.0, 1.0, 1.0])
box.append([ 1.0, -1.0, -1.0])
box.append([ 1.0, -1.0, 1.0])
box.append([ 1.0, 1.0, -1.0])
box.append([ 1.0, 1.0, 1.0])
# camera inside box?
if cam.boxInsideFrustum(box) != cam.OUTSIDE:
# box is inside
# your code here
else:
# box is outside
# your code here