Module KX_Scene

Source Code for Module KX_Scene

 1  # $Id: KX_Scene.py 2717 2004-06-26 09:15:41Z kester $ 
 2  # Documentation for KX_Scene.py 
 3   
4 -class KX_Scene:
5 """ 6 Scene. 7 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 10 what it does! 11 12 Example:: 13 import GameLogic 14 15 # get the scene 16 scene = GameLogic.getCurrentScene() 17 18 # print all the objects in the scene 19 for obj in scene.getObjectList(): 20 print obj.getName() 21 22 # get an object named 'Cube' 23 obj = scene.getObjectList()["OBCube"] 24 25 # get the first object in the scene. 26 obj = scene.getObjectList()[0] 27 28 Example:: 29 # Get the depth of an object in the camera view. 30 import GameLogic 31 32 obj = GameLogic.getCurrentController().getOwner() 33 cam = GameLogic.getCurrentScene().active_camera 34 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] 37 38 @bug: All attributes are read only at the moment. 39 40 @ivar name: The scene's name 41 @type name: string 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 50 """ 51
52 - def getLightList():
53 """ 54 Returns the list of lights in the scene. 55 56 @rtype: list [L{KX_Light}] 57 """
58 - def getObjectList():
59 """ 60 Returns the list of objects in the scene. 61 62 @rtype: list [L{KX_GameObject}] 63 """
64 - def getName():
65 """ 66 Returns the name of the scene. 67 68 @rtype: string 69 """
70