I want calculate the distance from object A to object B and assign a property(float) to the distance accordingly. Being new to python this is what I came up with:
import bge
controller = bge.logic.getCurrentController()
Ray = controller.sensors[0]
if (Ray.positive):
Distance = ray.hitPosition
propertyActuator = controller.actuators[0]
propertyActuator.value = str(Distance)
controller.activate(propertyActuator)
Why is it not working? Can I do it differently?
Thanks for anwsering
Peasant