Skip to content

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

@FrankenApps

Description

@FrankenApps

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 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions