Real-time distance calculation