Hello,
I am using ARkit for face tracking with the Truth Depth camera. However, after reading this post https://github.com/Unity-Technologies/arfoundation-samples/issues/288#issuecomment-661634964 and https://stackoverflow.com/questions/57582930/why-does-arfaceanchor-have-negative-z-position
I noticed that ARFaceAnchor is actually left-handed instead of right-handed as the documentation described.
Currently I have:
I am wondering how to correct it using the following suggestion from SO:
Sorry I am a bit new to ARkit and wondering how to properly use the suggestion above to correct the coordinate system.
I am using ARkit for face tracking with the Truth Depth camera. However, after reading this post https://github.com/Unity-Technologies/arfoundation-samples/issues/288#issuecomment-661634964 and https://stackoverflow.com/questions/57582930/why-does-arfaceanchor-have-negative-z-position
I noticed that ARFaceAnchor is actually left-handed instead of right-handed as the documentation described.
Currently I have:
Code Block extension ViewController: ARSCNViewDelegate { func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { guard let faceAnchor = anchor as? ARFaceAnchor else { return } currentFaceAnchor = faceAnchor if node.childNodes.isEmpty, let contentNode = selectedContentController.renderer(renderer, nodeFor: faceAnchor) { node.addChildNode(contentNode) } selectedContentController.session = sceneView?.session selectedContentController.sceneView = sceneView } /// - Tag: ARFaceGeometryUpdate func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) { guard anchor == currentFaceAnchor, let contentNode = selectedContentController.contentNode, contentNode.parent == node else { return } selectedContentController.session = sceneView?.session selectedContentController.sceneView = sceneView selectedContentController.renderer(renderer, didUpdate: contentNode, for: anchor) } }
I am wondering how to correct it using the following suggestion from SO:
Code Block func faceAnchorPoseToRHS(_ mat: float4x4) -> float4x4 { let correctedPos = float4(x: mat.columns.3.x, y: mat.columns.3.y, z: -mat.columns.3.z, w: 1) let quat = simd_quatf(mat) let newQuat = simd_quatf(angle: -quat.angle, axis: float3(quat.axis.x, quat.axis.y, -quat.axis.z)) var newPose = float4x4(newQuat) newPose.columns.3 = correctedPos return newPose }
Sorry I am a bit new to ARkit and wondering how to properly use the suggestion above to correct the coordinate system.