0
私はSceneKitの使用に初心者で、私のノードは私の画面には大きすぎます(半径を変更しても下のコードと写真を参照してください)。私のSCNNodesは、指定された半径に対して一定のサイズです
コード:https://pastebin.com/GGikSTyY
let scene = SCNScene()
sceneView.autoenablesDefaultLighting = true
sceneView.allowsCameraControl = true
// If I set size to 2, 5, 120 the answer is the same.
let hydrogenAtom = SCNSphere(radius: 0.2)
hydrogenAtom.firstMaterial!.diffuse.contents = UIColor.lightGray
hydrogenAtom.firstMaterial!.specular.contents = UIColor.red
let atomsNode = SCNNode()
let carbonNode = SCNNode(geometry: hydrogenAtom)
carbonNode.position = SCNVector3Make(-6, 0, 0)
atomsNode.addChildNode(carbonNode)
scene.rootNode.addChildNode(atomsNode)
sceneView.scene = scene
とのviewDidLoad内のコードのこの作品があります:(私は設定何でも半径用)
override func viewDidLoad() {
super.viewDidLoad()
sceneView.frame = self.viewMain.bounds
sceneView.backgroundColor = UIColor.clear
self.viewMain.addSubview(sceneView)
}
画像:enter image description here
ありがとう!