Created
June 28, 2021 09:39
-
-
Save ThomasGorisse/c3beaab1b4e0a25e4c6351d794fbe65d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void updateRegionNodes() { | |
if (augmentedFace == null) { | |
return; | |
} | |
Pose centerPose = augmentedFace.getCenterPose(); | |
faceRegionNode.setWorldPosition(new Vector3(centerPose.tx(), centerPose.ty(), centerPose.tz())); | |
// Rotate the bones by 180 degrees because the .fbx template's coordinate system is | |
// inversed of Sceneform's coordinate system. This is so the .fbx works with other | |
// 3D rendering engines as well | |
//TODO: Remove the inversion here and on the .blend and .glb files | |
Quaternion rotation = new Quaternion(centerPose.qx(), centerPose.qy(), centerPose.qz(), centerPose.qw()); | |
Quaternion inverse = new Quaternion(Vector3.up(), 180f); | |
rotation = Quaternion.multiply(rotation, inverse); | |
faceRegionNode.setWorldRotation(rotation); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment