Swift 如何移除arView.session.currentFrame的锚?
最近,我研究了ARWorldTrackingConfiguration。但这是非常困难的。首先我想使用这个函数:Swift 如何移除arView.session.currentFrame的锚?,swift,xcode,augmented-reality,arkit,lidar,Swift,Xcode,Augmented Reality,Arkit,Lidar,最近,我研究了ARWorldTrackingConfiguration。但这是非常困难的。首先我想使用这个函数: func session(_ session: ARSession, didRemove anchors: [ARAnchor]) { } 我已经试过了,但不起作用: arView.session.remove(anchor: frame.anchors[0]) arView.session.currentFrame?.anchors.removeAll() // 'anchors
func session(_ session: ARSession, didRemove anchors: [ARAnchor]) { }
我已经试过了,但不起作用:
arView.session.remove(anchor: frame.anchors[0])
arView.session.currentFrame?.anchors.removeAll() // 'anchors' is a get-only property
有人知道通过使用某些东西来“删除”会话函数吗
请帮助我掌握ARkit。要将ARAnchor从ARSession中删除,您需要使用实例方法:
let specialAnchor = ARAnchor(name: "special", transform: simd_float4x4())
arView.session.remove(anchor: specialAnchor)
当从会话中删除锚定时,将调用您提到的方法:
func session(_ session: ARSession, didRemove anchors: [ARAnchor]) {
self.anchorsData(anchors: anchors)
}
func anchorsData(anchors: [ARAnchor]) -> [Any] {
var data = [Any]()
// some code...
return data
}
感谢您的评论,我使用了arView.session.remove,但它出现在网格贴图上。在apear会话更新之前,您知道会话删除吗