Skip to content

Instantly share code, notes, and snippets.

@ThomasGorisse
Created June 28, 2021 09:39
Show Gist options
  • Save ThomasGorisse/c3beaab1b4e0a25e4c6351d794fbe65d to your computer and use it in GitHub Desktop.
Save ThomasGorisse/c3beaab1b4e0a25e4c6351d794fbe65d to your computer and use it in GitHub Desktop.
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