如果ARCamera向左,向右,向上或向下移动,并且该节点在ARCamera中不可见。我想指出您需要向上/向下/向右/向左移动相机的箭头。
答案 0 :(得分:2)
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)]