So I'm fairly new to ARKit and SceneKit, and I'm following the tutorial from Apple here. https://developer.apple.com/documentation/arkit/tracking_and_visualizing_faces.
What I'm trying to do is create a view, similar to the Animoji screen, where the SCNNode containing the BlendShape is centred in the view and z value of the Blendshape does not change depending on how close/far the face is from the camera. I'd also like to make the camera invisible so you can only see the BlendShape.
What is the best way of going about this and how?
I've tried setting the pivot to 0 and the position.z to 0 too, but I don't think this is the correct approach.
func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) {
guard let faceAnchor = anchor as? ARFaceAnchor
else { return }
let blendShapes = faceAnchor.blendShapes
guard let eyeBlinkLeft = blendShapes[.eyeBlinkLeft] as? Float,
let eyeBlinkRight = blendShapes[.eyeBlinkRight] as? Float,
let jawOpen = blendShapes[.jawOpen] as? Float
else { return }
eyeLeftNode.scale.z = 1 - eyeBlinkLeft
eyeRightNode.scale.z = 1 - eyeBlinkRight
jawNode.position.y = originalJawY - jawHeight * jawOpen
node.pivot = SCNMatrix4MakeTranslation(0,0,0)
node.position.z = 0
}
A view below is similar to what I'm trying to achieve, without the list of other blendshapes.