Fatal error: Unexpectedly found nil while unwrapping an Optional value

Hi dev’, i have  got a ” Fatal error: Unexpectedly found nil while unwrapping an Optional value” on my code. Can you help me please?

 

 

 

/

/

/

/

/

/

/

import UIKit

import SceneKit

import ARKit

class ViewController: UIViewController, ARSCNViewDelegate {

    @IBOutlet var sceneView: ARSCNView!

 

    func addsiteWeb(x: Float = 0, y: Float = 0, z: Float = -0.5) {

        guard let siteWebScene = SCNScene(named: “SceneKit Scene.scn”), let siteWebNode = siteWebScene.rootNode.childNode(withName: “siteweb”, recursively: true) else { return }

        siteWebNode.position = SCNVector3(x, y, z)

        sceneView.scene.rootNode.addChildNode(siteWebNode)

    }

  

    override func viewDidLoad() {

        super.viewDidLoad()

        addsiteWeb()

      

        /

        sceneView.delegate = self

      

        /

        sceneView.showsStatistics = true

      

        sceneView.debugOptions = ARSCNDebugOptions.showWorldOrigin

      

        /

        let scene = SCNScene(named: “SceneKit Scene.scn”)!                                  HERE please

      

        /

        sceneView.scene = scene

    }

  

    override func viewWillAppear(_ animated: Bool) {

        super.viewWillAppear(animated)

      

        /

        let configuration = ARWorldTrackingConfiguration()

        /

        sceneView.session.run(configuration)

    }

  

    override func viewWillDisappear(_ animated: Bool) {

        super.viewWillDisappear(animated)

      

        /

        sceneView.session.pause()

    }

  

    override func didReceiveMemoryWarning() {

        super.didReceiveMemoryWarning()

        /

    }

    /

  

/

    /

    func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? {

        let node = SCNNode()

   

        return node

    }

*/

  

    func session(_ session: ARSession, didFailWithError error: Error) {

        /

      

    }

  

    func sessionWasInterrupted(_ session: ARSession) {

        /

      

    }

  

    func sessionInterruptionEnded(_ session: ARSession) {

        /

      

    }

}

Powered by WPeMatico

About

You may also like...

Comments are closed.