1 Reply
      Latest reply on Mar 18, 2019 2:30 PM by gchiste
      gustavo.gleite1 Level 1 Level 1 (10 points)

        Hi everybody!


        So basically the Delegation method of ARSCNViewDelegate :


            func renderer(_ renderer: SCNSceneRenderer,nodeFor anchor : ARAnchor) -> SCNNode? {
                guard let faceAnchor = anchor as? ARFaceAnchor,
                    let device = MTLCreateSystemDefaultDevice() else {
                        return nil
                let faceGeometry = ARSCNFaceGeometry(device: device)
                let node = SCNNode(geometry: faceGeometry)
                node.geometry?.firstMaterial?.fillMode = .lines
                return node


        It isn't called on Swift Playgrounds. I'm using an iPad Pro 11 (with Truedepth frontal-camera). I tried to run the same code on Xcode, and I got it! But on Swift Playgrounds I did not succeed.


        I put this in viewDidLoad, viewWillAppear and viewWillDisappear:


             override func viewDidLoad() {
                guard ARFaceTrackingConfiguration.isSupported else {
                    fatalError("Face tracking is not supported on this device")
                sceneView.delegate = self
                self.view = sceneView
            override func viewWillAppear(_ animated: Bool) {
                let configuration = ARFaceTrackingConfiguration()
                configuration.isLightEstimationEnabled = true
                sceneView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
            override func viewWillDisappear(_ animated: Bool) {

        I need to call this function "func renderer(_ renderer: SCNSceneRenderer,nodeFor anchor : ARAnchor) -> SCNNode?", but the method doesn't work in the delegation.

        Could anyone help me?