notes/Blender 3D Game Get Distance To Object-Cy9HdV3e.sh
import bge

scene = bge.logic.getCurrentScene()
owner = bge.logic.getCurrentController().owner
ob2 = scene.objects['Sphere']
 
length = owner.getDistanceTo(ob2)
print(length)

syntax highlighted by Code2HTML, v. 0.9.1