[I've already submitted this via Feedback Assistant, issue FB8904434. Providing a brief summary here for other affected developers to discover.]
The behavior of unprojectPoint(_:) has changed in iOS 14, for both
ARSCNView and SCNView.
The unprojected point should be most distant for a z-value of 1.0.
But in iOS 14, it is actually most distant for a z-value of 0.5.
Background
When you unproject a screen coordinate, you provide a z value between 0.0 and 1.0 to specify the depth. 0.0 corresponds to the near clipping plane, 1.0 to the far clipping plane, and intermediate values map in between.
Expected/documented behavior:
Distance from the unprojected point to the camera should increase monotonically (though not necessarily linearly) with z.
Observed behavior: iOS 13: distance increases monotonically with z. Takes a huge jump between z = 0.9 and z = 1.0.
iOS 14: distance increases for z 0.0 to 0.5, then decreases. Takes a huge jump on either side of z = 0.5.
Note
I am surprised by just how non-linear the mapping is, under either version of iOS. For example, under iOS 13 as z varies from 0.0 to 0.9, the distance changes from 0.5 mm to 5 mm. Then at 1.0 the distance jumps to over 1000 meters.
Post
Replies
Boosts
Views
Activity
Anybody else seeing something similar to this? (I've just reported it via Feedback Assistant)iOS 13.1.2 is misbehaving when supportedInterfaceOrientations == .portrait:1. In Xcode, create new “Augmented Reality App” project.2. In ViewController.swift/viewDidLoad(), add debug UI: sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints, ARSCNDebugOptions.showWorldOrigin]3. In ViewContoller.swift, add: override var supportedInterfaceOrientations: UIInterfaceOrientationMask { return .portrait }4. Using an iOS 12 device, hold device in landscape-right orientation and launch the app.=> As expected, camera image is rotated counterclockwise.=> As expected, the AR model and AR axes are also rotated counterclockwise.=> As expected, feature points appear reasonable.5. Using an iOS 13.1.2 device, hold device in landscape-right orientation and launch the app.=> As expected, camera image is rotated counterclockwise.=> Unexpectedly, the AR model and AR axes are NOT rotated counterclockwise.=> Unexpectedly, feature points appear quite wrong.