通过 Swift 设置 ARKit 方向 [英] Setting ARKit Orientation via Swift
问题描述
我正在使用 OpenGL
开发 ARKit 应用程序,因此直接使用 ARKit 而不是使用 SceneKit.
I am developing an ARKit app with OpenGL
, so working directly with ARKit and not using SceneKit.
默认情况下,ARKit 设置为横向,但我一直无法找到任何文档或示例以旋转为纵向.SceneKit 示例适用于纵向,但 Metal
示例仅适用于横向.
By default, ARKit is set to landscape orientation, but I have been unable to track down any documentation or examples to rotate to portrait. SceneKit example works in portrait but the Metal
example only works in landscape.
是否可以更改 ARKit 跟踪方向?
Is it possible to change the ARKit tracking orientation?
推荐答案
通过将相机矩阵乘以基于设备方向旋转的四元数,我能够在应用程序逻辑中解决此问题.
I was able to solve this in the application logic by multiplying the camera matrix by a quaternion that is rotated based on device orientation.
这篇关于通过 Swift 设置 ARKit 方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!