如何在ARKit中使用垂直检测? [英] How use vertical detection in ARKit?

查看:0
本文介绍了如何在ARKit中使用垂直检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何插入垂直固定在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)
}

推荐答案

您需要合适的垂直表面进行跟踪。纯色的墙(上面没有可区分的特征)是非常糟糕的情况(你可以在左边的图像上看到这样一个垂直的表面)。跟踪垂直表面最可靠的方法是光线良好的砖墙,或上面有图片的墙,或具有可识别图案的墙,等等。

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

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

希望这能有所帮助。

这篇关于如何在ARKit中使用垂直检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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