Post not yet marked as solved
Post marked as unsolved with 4 replies, 776 views
[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.