【问题标题】:How use vertical detection in ARKit?如何在 ARKit 中使用垂直检测?
【发布时间】:2019-04-30 16:16:40
【问题描述】:

如何在 ARKit 上插入 SCNScene 并垂直保持?我不能做滞留并将物体插入垂直位置。

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
    let scene = SCNScene(named: "art.scnassets/tabellone.scn")

    sceneView?.debugOptions = [SCNDebugOptions.showFeaturePoints]

    // Set the scene to the view
    sceneView?.scene = scene!
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    // Create a session configuration
    let configuration = ARWorldTrackingConfiguration()

    configuration.planeDetection = .vertical
    configuration.isLightEstimationEnabled = true

    // Run the view's session
    sceneView?.session.run(configuration)
}

【问题讨论】:

    标签: swift augmented-reality arkit


    【解决方案1】:

    您需要一个适当的垂直表面来进行跟踪。纯色的墙(上面没有可区分的特征)是非常糟糕的例子(你可以在左图中看到这样的垂直表面)。跟踪垂直表面最可靠的方法是光线充足的砖墙,或上面有图片的墙,或带有可区分图案的墙等。

    因此,正确的图像是跟踪和垂直平面检测的一个很好的例子。

    如果您想探索如何将 3D 对象放置到检测到的平面上,请查看 Apple 的 Handling 3D Interaction and UI Controls in AR 项目。

    希望这会有所帮助。

    【讨论】:

    • 这取决于你想得到什么。但是代码本身是正确的。
    • 我要选择一个垂直平面并插入.scn对象
    猜你喜欢
    • 2017-11-09
    • 1970-01-01
    • 2019-09-11
    • 2013-08-04
    • 2018-02-09
    • 1970-01-01
    • 1970-01-01
    • 2014-10-20
    相关资源
    最近更新 更多