aeyrium-sensor icon indicating copy to clipboard operation
aeyrium-sensor copied to clipboard

Roll sensor value jumps from 0 to ~ 2*pi on iPhone 8 when the phone lays flat.

Open FrankenApps opened this issue 6 years ago • 0 comments

I have used this library on android (emulator and real device without any problems), however on the iPhone 8 (physical device) the roll sensor value jumps from 0 to approximately 2*pi or 6.28... when the phone lays flat. Whereas on android it changes from 1 to 0 to -1 for example, when i rotate the device. I think, the library should give consistent results on android and iOS. I would prefer it the android way. In the meantime I use this workaraound:

if(Platform.isIOS){
  if(event.roll < (-1)*pi){
    sensorValue = 2*pi+event.roll;
  } 
  else{         
    sensorValue = event.roll;
  }
} 
else{
  sensorValue = event.roll;     //roll in radians for android 
}

FrankenApps avatar Aug 25 '19 09:08 FrankenApps