通过Swift设置ARKit方向 [英] Setting ARKit Orientation via Swift

查看:138
本文介绍了通过Swift设置ARKit方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆