Class KX_Scene
Scene.
The activity culling stuff is supposed to disable logic bricks when
their owner gets too far from the active camera. It was taken from some
code lurking at the back of KX_Scene - who knows what it does!
Example:
import GameLogic
# get the scene
scene = GameLogic.getCurrentScene()
# print all the objects in the scene
for obj in scene.objects:
print obj.name
# get an object named 'Cube'
obj = scene.objects["OBCube"]
# get the first object in the scene.
obj = scene.objects[0]
Example:
# Get the depth of an object in the camera view.
import GameLogic
obj = GameLogic.getCurrentController().getOwner()
cam = GameLogic.getCurrentScene().active_camera
# Depth is negative and decreasing further from the camera
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]
Bug:
All attributes are read only at the moment.
list [KX_LightObject]
|
getLightList()
Returns the list of lights in the scene. |
|
|
list [KX_GameObject]
|
getObjectList()
Returns the list of objects in the scene. |
|
|
string
|
getName()
Returns the name of the scene. |
|
|
KX_GameObject
|
addObject(object,
other,
time=0)
Adds an object to the scene like the Add Object Actuator would, and
returns the created object. |
|
|
KX_Camera
|
active_camera
The current active camera
|
boolean
|
activity_culling
True if the scene is activity culling
|
float
|
activity_culling_radius
The distance outside which to do activity culling.
|
string
|
name
The scene's name
|
CListValue of KX_GameObject
|
objects
A list of objects in the scene.
|
boolean
|
suspended
True if the scene is suspended.
|
addObject(object,
other,
time=0)
|
|
Adds an object to the scene like the Add Object Actuator would, and
returns the created object.
- Parameters:
object (KX_GameObject or string) - The object to add
other (KX_GameObject or string) - The object's center to use when adding the object
time (int) - The lifetime of the added object, in frames. A time of 0 means
the object will last forever.
- Returns: KX_GameObject
|
activity_culling_radius
The distance outside which to do activity culling. Measured in manhattan
distance.
- Type:
- float
|