Calculating heading of compass to a specific coordinate instead of to north
I can't get this algorithm right. I'm trying to make a compass that points at a certain location instead of just pointing to, let's say, north. Something is wrong. I've spent a lot of time trying to figure this out, but i just can't find it. Any ideas? - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading{ double distanceEast = (location.longitude > 0 && otherLocation.longitude < 0) ? 180 - location.longitude + otherLocation.longitude - -180: otherLocation.longitude - location.longitude; if (distanceEast < 0) { distanceEast += 360; } double distanceWest