|
getDistanceTogetDistanceTo(other)Returns the distance between 2 objects/points. No x , y or z values. Just the distance.Return type: float other: Type:
KX_GameObject ( a game object)
or list [ x, y, z] (a point) Sample Code# get the controllercontroller = GameLogic.getCurrentController()# get the game object that the controller is attached to.obj = controller.owner# get the current scenescene = GameLogic.getCurrentScene()# get a list of the objects in the sceneobjList = scene.objects# get object named Boxbox = objList["OBBox"]# get the distance between themdistance = obj.getDistanceTo(box) |