Skip to content

Commit

Permalink
Fix AugmentedFaceNode crash when no skeleton is defined on the model
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasGorisse committed Dec 22, 2021
1 parent 9c72cbe commit e665194
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions ux/src/main/java/com/google/ar/sceneform/ux/AugmentedFaceNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,19 @@ private void updateRegionNodes() {

Matrix.multiplyMM(matrix, 0, inverseRootNodeMatrix, 0, regionPoseMatrix, 0);

int instance = tfm.getInstance(faceMeshSkeleton.get(type));

tfm.setTransform(instance, matrix);

tfm.getWorldTransform(instance, matrix);
float[] position = new float[4];
Matrix.multiplyMV(position, 0, matrix, 0, new float[] { 0, 0, 0, 1 }, 0);
Log.d(TAG, type + " " + Arrays.toString(position));
if(faceMeshSkeleton.containsKey(type)) {
int instance = tfm.getInstance(faceMeshSkeleton.get(type));
tfm.setTransform(instance, matrix);
tfm.getWorldTransform(instance, matrix);
}
// Log Position
// float[] position = new float[4];
// Matrix.multiplyMV(position, 0, matrix, 0, new float[] { 0, 0, 0, 1 }, 0);
// Log.d(TAG, type + " " + Arrays.toString(position));
}
if(faceRegionNode != null && faceRegionNode.getRenderableInstance() != null) {
faceRegionNode.getRenderableInstance().getFilamentAsset().getAnimator().updateBoneMatrices();
}
faceRegionNode.getRenderableInstance().getFilamentAsset().getAnimator().updateBoneMatrices();
}

private boolean isTracking() {
Expand Down

0 comments on commit e665194

Please sign in to comment.