首页 > 解决方案 > 如何为 SCNSphere 选择合适的半径?

问题描述

我正在开发 360 度图像查看器,为此我使用 SCNSphere。问题是创建球体时应该使用什么半径?

到目前为止,我注意到将半径设置在 10 到 100 之间的任何位置都可以在我的图像上正常工作。但是,假设图像环绕球体,半径不应该是 2*Pi / image.width (其中 C = 2*Pi*R)?不知何故,这在我使用的尺寸为 1600 x 800 的图像上根本不起作用。

这是我的代码:

let material = SCNMaterial()
material.diffuse.contents = image360
let sphere = SCNSphere(radius: 10)
sphere.segmentCount = 300
sphere.firstMaterial = material
let node = SCNNode()
node.geometry = sphere

为了澄清这个问题:如何为 SCNSphere 选择合适的半径,图像(比如尺寸为 1600x800)作为材料?

谢谢!

标签: iosswiftscenekitscnnodescnsphere

解决方案


推荐阅读