我正在使用ARKit,当我找到水平面时,就将其放置在立方体中,就像在照片中一样。 See image here - The red square is where my elements from scene should appear
在多维数据集前面,我添加了一个计划,并且希望在此平面上显示我的SKScene。 我的将立方体,平面和场景添加到平面的代码:
func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? {
let box = SCNScene(named: "box.scn")?.rootNode.childNode(withName: "container", recursively: true)
if let gameSKScene = SKScene(fileNamed: "GameScene") {
gameSKScene.scaleMode = .aspectFill
gameSKScene.backgroundColor = .red
let gameNode = box?.childNode(withName: "plane", recursively: true)
let gameMaterial = SCNMaterial()
gameMaterial.diffuse.contents = gameSKScene
gameNode?.geometry?.firstMaterial = gameMaterial
}
return box
}
如果有人可以帮助我((: