0 Replies
      Latest reply on Jul 9, 2019 2:03 AM by LightNight7
      LightNight7 Level 1 Level 1 (0 points)

        The code looks like this:
        But the printed identifier has not changed, is it always one? Is there anything I set up?

        override func viewWillAppear(_ animated: Bool) {

                super.viewWillAppear(animated)

         

                let configuration = ARFaceTrackingConfiguration()

           

                print(ARFaceTrackingConfiguration.supportedNumberOfTrackedFaces)

           

                configuration.maximumNumberOfTrackedFaces = 2

           

                faceSCNView.session.run(configuration)

            }



         

        extension GameViewController : ARSCNViewDelegate {

         

            func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {

                if anchor is ARFaceAnchor {

                    print( anchor.identifier , anchor.name ?? "")

                }

            }

         

            func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) {

                guard

                    let faceAnchor = anchor as? ARFaceAnchor

                    else { return}

             

                print(faceAnchor.identifier , faceAnchor.blendShapes[.mouthClose] ?? 0)

            }

        }

         

        extension GameViewController : ARSessionDelegate {

         

            func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {

             

              print(anchors.count)

                for anchor in anchors where anchor is ARFaceAnchor {

                 

                    let faceAnchor = anchor as! ARFaceAnchor

                 

                    print("Session AddAnchor", faceAnchor.identifier , faceAnchor.blendShapes[.mouthClose] ?? 0)

                }

            }

         

            func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {

             

                for anchor in anchors where anchor is ARFaceAnchor {

                 

                    let faceAnchor = anchor as! ARFaceAnchor

                 

                    print("Session Update", faceAnchor.identifier , faceAnchor.blendShapes[.mouthClose] ?? 0)

                 

                 

                }

            }

        }