Class KX_Camera -- Blender Game Engine 2.49b



 
   




getScreenPosition

getScreenPosition(obj)

Returns the screen coordinates of a game object (or a point) on the game screen.

Return type:
list [x, y]  (screen coordinates)
Range:  0.0 to 1.0

obj:
Type:  KX_GameObject
   or
   string (object name)
   or
   list [x, y, z] (point 3D world position)


Note:

Center of game screen is approximately [ 0.5, 0.5]


Sample Code

# get the current scene
scene = GameLogic.getCurrentScene()

# get the active camera
cam = scene.active_camera

# get object list
objList = scene.objects

# get game object named Cube
cube = objList["OBCube"]

# get game screen position of cube
pos = cam.getScreenPosition(cube)

 
Game developers can use the game engine to create casual video games, first and third person shooters, role playing games, racing simulations and more. The game engine can be used to make both 2D games and 3D games.  Beginning game developers will only need basic knowledge of game design and programming to create rich and complex game models with photo realistic textures to add detail to the graphics of the video game.  Today's games need more than good looking low polygon game models.  Use normal maps and photo realistic textures to create high quality game models.