getScreenRay
getScreenRay(x, y, dist, prop)
Looks
towards a screen coordinate and returns the 1st game object hit with
the property named and within the distance specified.
Returns:
KX_GameObject
or
None (if didn't find a game object)
x:
x screen coordinate
Type:
float
y:
y screen
coordinate
Type:
float
dist :
maximum distance to
look:
use negative
distance to look behind
0.0 equals unlimited distance to look.
property:
property name to
look for
no property name
equals look for all property names.
Sample
Code
# get the current scene
scene = GameLogic.getCurrentScene()
# get the active camera
cam = scene.active_camera
# get 1st object with property "Blue_Player"
obj = cam.getScreenRay(0.5, 0.5, 7.0, "Blue_Player")
|