I am using ARKit3.
I tried DL the sample code from the following URL.
Tracking and Visualizing Faces
https://developer.apple.com/documentation/arkit/tracking_and_visualizing_faces
I tried to get a face rotation value by inserting a print statement into TransformVisualization.swift as shown in the code below.
func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) {
guard #available(iOS 12.0, *), let faceAnchor = anchor as? ARFaceAnchor else { return }
print(faceAnchor.transform.columns.2)
rightEyeNode.simdTransform = faceAnchor.rightEyeTransform
leftEyeNode.simdTransform = faceAnchor.leftEyeTransform
}
faceanchor.transform can get 4x4 matrix.
Doesn't faceanchor.transform.columns.2 contain head rotation values?
When I actually moved my head and checked the printed numbers, the values of rotation.x(faceAnchor.transform.columns.2.x) and rotation.y(faceAnchor.transform.columns.2.y) were obtained correctly.
However, the initial value of rotation.z(faceAnchor.transform.columns.2.z) is strange, and hardly changes even if I move my head.
How can I get the rotation value around the Z axis?