Start a new topic

Camera not rotated 180 when device is

I'm building out an iOS app (on a 3rd party platform, they have integrated 8.6 of the iOS Javascript  SDK). Users will be having iPads which sometimes will be hun around their neck and upside down. I've noticed in all of my AR activities, that when an AR view is launched and the user rotates the device through 180 degrees (landscape to landscape) the view rotates correctly, along with the overlay, but the camera does not rotate. 


Attached is a zip of the project, which is using Geolocation only.


See helicopter_normal.jpg for what it looks like when launched the correct way up. 

See helicopter_rotated.jpg for what it looks like when launched upside down, then rotated through 180.

zip
1 Comment

Hi James,


This looks like an issue in the native side of your app, you may not be communicating the orientation to the WTArchitectView in your ViewController.


Here's a snippet that you can also find in our JS example app, in the Examples folder of the SDK package that you can download here https://www.wikitude.com/download-wikitude-sdk-for-ios/.


/* Wikitude SDK Rotation handling
 *
 * viewWillTransitionToSize -> iOS 8 and newer
 * willRotateToInterfaceOrientation -> iOS 7
 *
 * Overriding both methods seems to work for all the currently supported iOS Versions
 * (7, 8, 9). The run-time version check is included nonetheless. Better safe than sorry.
*/

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
   if (coordinator)
   {
       [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context)
        {
            UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
            [self.architectView setShouldRotate:YES toInterfaceOrientation:orientation];
        } completion:nil];
   }
   else
   {
       UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
       [self.architectView setShouldRotate:YES toInterfaceOrientation:orientation];
   }

   [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    //if iOS 8.0 or greater according to http://stackoverflow.com/questions/3339722/how-to-check-ios-version
    if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] != NSOrderedAscending) {
        return;
    }
    [self.architectView setShouldRotate:YES toInterfaceOrientation:toInterfaceOrientation];
}


Please let us know if the same problem persists after adding this code to your ViewController.


Thank you.

- Damian

Login or Signup to post a comment