|
rayCastTorayCastTo(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)
distance:or a position ( [x, y, z]) float values. 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 tocontroller = GameLogic.getCurrentController()# get game object rayCastTo is attached toobj = controller.owner# get the current scenescene = GameLogic.getCurrentScene()# get a list of the objects in the sceneobjList = scene.objects# get the object named Cube that rayCastTo is pointing atcube = objList["OBCube"]# set a trip wire between owner and cubetripped = obj.rayCastTo(cube, 0, "blueTeam") |