如果ARCamera向左,向右,向上或向下移动,并且该节点在ARCamera中不可见。我想指出您需要向上/向下/向右/向左移动相机的箭头。
最佳答案
if let pointOfView = sceneView.pointOfView{
let isMaybeVisible = sceneView.isNode((displayNode.presentation), insideFrustumOf: pointOfView)
if isMaybeVisible{
if arrowVisible{
arrow.removeFromParentNode()
}
}else{
if !arrowVisible{
sceneView.pointOfView?.addChildNode(arrow)
}
}
}
isNode(_:insideFrustumOf:)
在此检查节点是否在ARCamera中可见。在
renderer(_:updateAtTime:)
中使用它编辑:
这里的箭头是节点(3d箭头)。记住箭头需要面对-z轴
let scene = SCNScene(named: "art.scnassets/arrow.dae")
let arrow = scene?.rootNode.childNode(withName: "arrow", recursively: false)
arrow.constraints = [SCNLookAtConstraint.init(target: node)]
关于ios - 一旦该节点在ARCamera中不可见,获取指向SCNNode的方向箭头,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53083642/