当应用程序首先启动时,在一面墙上检测到垂直表面,而不是相机聚焦到第二面墙,在第二面墙上检测到另一个表面。第一面墙现在对 ARCamera 不再可见,但此代码为我提供了第一面墙的锚点。但我需要第二面墙的锚点,现在在相机中可见/聚焦。
if let anchor = sceneView.session.currentFrame?.anchors.first {
let node = sceneView.node(for: anchor)
addNode(position: SCNVector3Zero, anchorNode: node)
} else {
debugPrint("anchor node is nil")
}
Run Code Online (Sandbox Code Playgroud)