【发布时间】:2023-04-02 16:49:01
【问题描述】:
我正在尝试更好地理解 SCNKit 和 ARKit,并在我的 iPhone(我将其用作简单的测试设备)上部署并运行准系统 Xcode 9 增强现实应用程序。
这个应用的源代码是here。
基本上,应用程序启动,相机初始化,并在场景(世界视图)内渲染 3D 战斗机,其方式类似于 Pokemon Go 将怪物注入您的相机视口(无论您将相机指向何处) .很酷!
这段代码都是 Xcode 为我自动生成的。因此,我试图了解决定 where 定位/定向战斗机的逻辑存在于何处(标题为 art.scnassets/ship.scn 的 SCN 文件)。从here 我们看到喷气式飞机正在装载:
override func viewDidLoad() {
super.viewDidLoad()
// Set the view's delegate
sceneView.delegate = self
// Show statistics such as fps and timing information
sceneView.showsStatistics = true
// Create a new scene
print("Hello there Mr. Zac")
let scene = SCNScene(named: "art.scnassets/ship.scn")!
// Set the scene to the view
sceneView.scene = scene
}
但我不明白应用程序如何选择哪里来放置喷气式飞机/船并将其定向到哪个方向。我问是因为第一步我想尝试重新定位喷气机,然后将其换成我自己的资产文件。
【问题讨论】:
标签: ios xcode augmented-reality arkit scnnode