SceneKit camera causes objects to Not Show Up

I want to be able to create a custom camera node in SceneKit and use it in my scene.

However, I've been encountering a very strange issue with SceneKit:

  • If I create a SCNCamera, attach it to a node, and add the node to my scene, then nothing shows up in my scene.
  • If I don't use a SCNCamera, the objects in my scene render correctly.

Also, if I try to access the camera node via sceneView.pointOfView, I get nil, even though sceneView.allowsCameraControl is set to true

This is the code I am using:

import UIKit
import SceneKit

class ViewController: UIViewController {
    override func viewDidLoad() {
        let sceneView = SCNView()
        sceneView.frame = self.view.frame
        let scene = SCNScene()
        sceneView.autoenablesDefaultLighting = true
        sceneView.allowsCameraControl = true
        let cameraNode = SCNNode()
        // If the below line of code is commented out (so no SCNCamera is added), everything shows up = SCNCamera()
        let sphere = SCNSphere(radius: 5)
        sphere.firstMaterial?.diffuse.contents =
        let sphereNode = SCNNode(geometry: sphere)

        sceneView.backgroundColor =
        sceneView.scene = scene


This seems pretty straightforward, yet I can't find any reason why this is happening on SO, etc.

There's a recent post on the Apple dev forums that may be related:

Have you found any solution?

Terms of Service

Privacy Policy

Cookie Policy