【发布时间】:2018-01-13 07:39:03
【问题描述】:
我尝试创建一个大的 SCNPlane 来覆盖整个屏幕。测试代码如下,其中一个红色框(尺寸 1x1x1)位于蓝色平面(尺寸 200 x200)的中间。它们都在中心点 (0, 0, 0),而相机距离该点仅 +5。
当平面节点面向相机(大角度)时,效果很好(图1),左右两侧都可以覆盖整个屏幕左右两侧。但是,当我将平面旋转到一个小角度(使用相机)时,只显示了一小部分。在图 2 中,飞机的左侧更靠近相机。左侧应该足够宽(100 的一侧)以覆盖屏幕的所有左侧,但事实并非如此。将飞机的尺寸增加到 10 倍(到 2000 年)并没有帮助。
对问题和解决方案有任何想法吗?谢谢
override func viewDidLoad() {
super.viewDidLoad()
let scnView = self.view as! SCNView
scnView.backgroundColor = UIColor.darkGray
scnView.autoenablesDefaultLighting = true
scnView.allowsCameraControl = true
scnView.scene = SCNScene()
let cameraNode = SCNNode()
cameraNode.camera = SCNCamera()
scnView.scene?.rootNode.addChildNode(cameraNode)
cameraNode.position = SCNVector3(x: 0, y: 0, z: 5)
let theBox = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0)
theBox.firstMaterial?.diffuse.contents = UIColor.red
let theBoxNode = SCNNode(geometry: theBox)
theBoxNode.position = SCNVector3(0, 0, 0)
scnView.scene?.rootNode.addChildNode(theBoxNode)
let plane = SCNPlane(width: 200, height: 200)
plane.firstMaterial?.diffuse.contents = UIColor.blue
let planeNode = SCNNode(geometry: plane)
scnView.scene?.rootNode.addChildNode(planeNode)
}
【问题讨论】: