我想在当前相机视图的边界中放置 2 行作为流:
来源 - SceneKit文档
从 ARKit 文档中,我了解到我需要projectionMatrix,但是如何计算从“zNear”到“zFar”和 x\y 的差异?
我从这段代码开始:
let cameraProjectionMatrix = session.currentFrame?.camera.projectionMatrix
let cameraPosition = SCNVector3.positionFromTransform(cameraProjectionMatrix)
let rightBoxNode = SCNNode(geometry: SCNBox(...))
rightBoxNode.position = SCNVector3(???)
sceneView.scene.rootNode.addChildNode(rightBoxNode)
对于左边的我可能需要
var leftPos = rightboxNode.position
leftPos.x = rightboxNode.position.x * -1
leftBoxNode.position = leftPos
但是我在尝试计算 rightboxNode.position 时失败了:
rightBoxNode.position = SCNVector3(x: x1 ,y: y1 z: zNear)