gpt4 book ai didi

ios - ARKIT 2.0 图像检测 : can't find when image disappear with ARImageTrackingConfiguration

转载 作者:行者123 更新时间:2023-11-28 10:38:41 25 4
gpt4 key购买 nike

在新的 arkit 2.0 文档中,它解释:并且可以准确跟踪图像何时从 View 中消失(或之后重新出现)

如何通知我图像不可见?我找不到有关它的文档。

谢天谢地,凯文

最佳答案

ARImageAnchor 符合 ARTrackable 协议(protocol),它:

is adopted by ARKit classes, such as the ARFaceAnchor class, that represent moving objects in a scene.

ARSCNView and ARSKView automatically hide the nodes for anchors whose isTracked property is false.

您可以阅读更多相关信息 here .

因此你可以做这样的事情来检查你的图像是否可见:

//--------------------------
//MARK: - ARSessionDelegate
//--------------------------

extension ViewController: ARSessionDelegate{

func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {

//1. Enumerate Our Anchors To See If We Have Found Our Target Anchor
for anchor in anchors{

if let imageAnchor = anchor as? ARImageAnchor, imageAnchor == targetAnchor{

//2. If The ImageAnchor Is No Longer Tracked Then Handle The Event
if !imageAnchor.isTracked{

}else{


}
}
}
}
}

其中 targetAnchor 只是一个 ARImageAnchor 我已将其引用存储为 全局变量。

希望对你有帮助

关于ios - ARKIT 2.0 图像检测 : can't find when image disappear with ARImageTrackingConfiguration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51966614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com