Hey all, I want to find the getPosition of an OB thats not of the OB I am using… for example. Say I call the script “foo” from an object(bob) when it gets close to another object(dave). how would I get the OB data from dave when my script is running in bob?
thats a question i always wanted to know, too!
-Connect your controller that handles the python script with an actuator
(it’s not important which one)of the object you want the position.Than in
the script add
pos is the position of the other obj,name_act the name of the actuator you added.
Its better for this situation I think to use a near sensor.
c = GameLogic.getCurrentController()
near = c.getSensor(“MyNearSensor”)
dave = near.getHitObjectList()
dave will be the first object that the near sensor reads. Make sure of course on the near sensor to make it look for prop “dave” and give Dave the prop “dave”.