0
$\begingroup$

When using own.hit Object List how do you print out the chosen item. I mean how do you go thought the list with the python system. Is it print(own.hit Object List[0],[10]) or something like that?......., and then receive a print out . I could use the info. i need for the a.i to chose the farthest object and track_to it trying to use Near sensor.

$\endgroup$

1 Answer 1

1
$\begingroup$

You can do it this way.

from bge import logic

if logic.getCurrentController.sensors['Near'].positive:
    for obj in controller.sensors['Near'].hitObjectList:
        print(obj)

KX_NearSensor

KX_TouchSensor

$\endgroup$

You must log in to answer this question.