【问题标题】:ARKit : Translate a 3D Object on camera viewARKit:在相机视图上翻译 3D 对象
【发布时间】:2017-12-20 10:31:06
【问题描述】:

我实际上是在使用 ARKit 在 xCode 上开发一个 AR 应用程序。

我的 iPad 处于特定方向,当我使用 ARWorldTrackingSessionConfiguration 将 (0,0,0) 上的 SCNode 添加到我的 SCNScene 时,当 iPad 垂直于地面时,它会出现在相机前面,就像这样:

iPad 垂直于地面,3D 物体在 (0,0,0)

我想让 我的 SCNode 在我启动 ARScene 时直接出现在 iPad 屏幕上,如下所示:

iPad 指向花盆的方向,我必须手动设置坐标

我该怎么做? 我想我必须做类似坐标翻译之类的事情,但我不知道该怎么做。 如果有帮助,我可以知道相机和花盆之间的距离

提前致谢! :)

【问题讨论】:

    标签: ios 3d scenekit arkit


    【解决方案1】:

    您需要将对象的坐标以SCNMatrix4形式传递如下:

    let translationMatrix = SCNMatrix4Translate(theNode.worldTransform, 0.1, 0.1, 0.1) //tx, ty, tz are translations in each axis i 然后theNode.transform = translation matrix

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-18
      • 2017-12-14
      • 2019-03-11
      • 1970-01-01
      • 1970-01-01
      • 2017-12-18
      • 2015-01-12
      相关资源
      最近更新 更多