When I run my iOS 13.2 SceneKit app using the iPad Pro 11" simulator (Version 11.2.1) on Xcode 11.2.1, the scene is cropped on the top and bottom. I'm trying to find the correct way to accomodate the unique aspect ratio of the iPad Pro 11" such that no cropping occurs. Allowing camera control in my app really isn't appropriate.
My app allows the SCNView to be zoomed; so my first thought was to check the constraints. The view hierarchy is as follows: A UINavigationController hosts three UIContainerViews. One of the containerViews hosts a UIViewController subclass instance. A UIScrollView's top, bottom, leading and trailing constraints are set to the safe area of that viewController's view. A SCNView's top, bottom, leading and trailing constraints are set to the safe area of the scrollView. The width constraint priority of the SCNView is 1000. The height constraint priority of the SCNView is 250. These settings allow correct display on all simulators except the iPad Pro 11".
The only solution that occurs to me is to add a control which allows the camera to be moved on the z-axis. Is there a better solution?
Thank you.
Hello @cfromns,
The "cropping" you are referring to here is actually a difference in the projection matrix of the virtual camera in your scene. Viewports with different sizes can have different projections.
There is no API that will aid you in positioning the camera to fit a particular portion of your scene within the viewport, please file an enhancement request for such API using Feedback Assistant.
It is possible to calculate a camera position to fit your content by making use of the field of view of the camera (or its projection matrix) and the bounds of the content you want to frame, but that is beyond the scope of support I'm providing here. If you are interested in implementing this, you will need to do some research on camera projection.
-- Greg