Quantcast
Channel: Questions in topic: "native plugin"
Viewing all articles
Browse latest Browse all 376

iOS plugin and device heading

$
0
0
Hi, I'm trying to pass the device heading from the iOS plugin to unity, but i can't understand how! I tried some examples found on the web but nothing works.. this is my .mm: - (void)startHeadingEvents { locationManager=[[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.delegate = self; locationManager.distanceFilter = 1000; [locationManager startUpdatingLocation]; if ([CLLocationManager headingAvailable]) { locationManager.headingFilter = 5; [locationManager startUpdatingHeading]; } } -(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading { if (newHeading.headingAccuracy < 0) return; // Use the true heading if it is valid. CLLocationDirection theHeading = ((newHeading.trueHeading > 0) ? newHeading.trueHeading : newHeading.magneticHeading); { mHeading = theHeading; } } @end extern "C" { float _GetHeading() { //should return mHeading } } Could someone help me? I don't know if it's the right solution, so if you have something different that works it's welcome! Thank you in advance

Viewing all articles
Browse latest Browse all 376

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>