Class KX_GameObject -- Blender Game Engine 2.49b



 
 



rayCastTo

rayCastTo(other, disance, property)

Returns the KX_GameObject that trips rayCastTo. (Acts like a laser beam trip wire between one object and an object/position.)

Method Parameters
other:
   Type:  KX_GameObject (object center)
   or
   a position  ( [x, y, z])  float values.
distance:
distance:
Type:  float
distance can be negative 
look behind the object rayCast is attached to.
distance = 0.0
ray stretches all the way to the other object center or position.
property:
Property on an object that triggers the ray.
property = ""
all properties trigger ray

Returns:
Return Type:  KX_GameObject
Returns None if it doesn't find anything.

Sample Code

# get controller rayCastTo is attached to
controller = GameLogic.getCurrentController()

# get game object rayCastTo is attached to
obj = controller.owner

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

# get a list of the objects in the scene
objList = scene.objects

# get the object named Cube that rayCastTo is pointing at
cube = objList["OBCube"]

# set a trip wire between owner and cube
tripped = obj.rayCastTo(cube, 0, "blueTeam")

 
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.