1
# $Id: KX_Scene.py,v 1.2 2004/06/26 09:15:40 kester Exp $
2
# Documentation for KX_Scene.py
8
The activity culling stuff is supposed to disable logic bricks when their owner gets too far
9
from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows
16
scene = GameLogic.getCurrentScene()
18
# print all the objects in the scene
19
for obj in scene.getObjectList():
22
# get an object named 'Cube'
23
obj = scene.getObjectList()["OBCube"]
25
# get the first object in the scene.
26
obj = scene.getObjectList()[0]
29
# Get the depth of an object in the camera view.
32
obj = GameLogic.getCurrentController().getOwner()
33
cam = GameLogic.getCurrentScene().active_camera
35
# Depth is negative and decreasing further from the camera
36
depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3]
38
@bug: All attributes are read only at the moment.
40
@ivar name: The scene's name
42
@ivar active_camera: The current active camera
43
@type active_camera: L{KX_Camera}
44
@ivar suspended: True if the scene is suspended.
45
@type suspended: boolean
46
@ivar activity_culling: True if the scene is activity culling
47
@type activity_culling: boolean
48
@ivar activity_culling_radius: The distance outside which to do activity culling. Measured in manhattan distance.
49
@type activity_culling_radius: float
54
Returns the list of lights in the scene.
56
@rtype: list [L{KX_Light}]
60
Returns the list of objects in the scene.
62
@rtype: list [L{KX_GameObject}]
66
Returns the name of the scene.