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
↧