Skip to content

Instantly share code, notes, and snippets.

@andijakl
Created May 7, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andijakl/a8f1416ddc22ac6f1488bf4589c47fd8 to your computer and use it in GitHub Desktop.
Save andijakl/a8f1416ddc22ac6f1488bf4589c47fd8 to your computer and use it in GitHub Desktop.
Creating an Anchor with ARCore for Amazon Sumerian
@JavascriptInterface
public void registerAnchor(final String requestId, final float[] matrix) {
if (requestId == null || matrix == null) {
return;
}
mSurfaceView.queueEvent(new Runnable() {
@Override
public void run() {
Pose anchorPose = Pose.makeTranslation(matrix[12], matrix[13], matrix[14]);
Anchor anchor = mSession.createAnchor(anchorPose);
final String scriptString = "ARCoreBridge.registerAnchorResponse('" + requestId + "', '" + String.valueOf(anchor.hashCode()) + "');";
evaluateWebViewJavascript(scriptString);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment