Thoughts and tutorials on programming

Tuesday, October 31, 2006

more code snippets how to get active_camera, getSensors of an object

import GameLogic
print dir(GameLogic)

print "current scene is "
liveScene = GameLogic.getCurrentScene()
#print dir(liveScene)
print "now from that here is the camera:"
print dir(liveScene.active_camera)

#for o in liveScene.getObjectList():
# print dir(o)

me = GameLogic.getCurrentController()

print "controller"
print dir(me)
print "sensors:"
for obj in me.getSensors():
print dir(obj)

2 comments:

Roger Pack said...

using this "scene.getobjectlist" can also reveal to one the object's properties thus:
scene.getObjectlist()["OB" + name].propertyname

Roger Pack said...

It is a kx_gameobject so you can also change the scale, and absolute position, etc.

Contributors

Followers