Skip to content

Instantly share code, notes, and snippets.

@andijakl
Last active August 8, 2019 14:48
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/e15ffdb7c5f99ec170fff7eeb11a6845 to your computer and use it in GitHub Desktop.
Save andijakl/e15ffdb7c5f99ec170fff7eeb11a6845 to your computer and use it in GitHub Desktop.
Call-back when the AR system of the device (ARCore / ARKit) sends the anchor ID to our scene, so that we can link it to the entity.
// Anchor registration callback. Sets the anchor ID of the entity's
// ArAnchorComponent. The engine's ArSystem will automatically update
// the world position and orientation of entities with a valid anchor ID.
registerAnchorCallback(anchorId) {
if (anchorId) {
this.internalAnchorEntity.getComponent('ArAnchorComponent').anchorId = anchorId;
console.log("Registered AR anchor: " + anchorId);
this.placeMode.set(false);
this.worldPlacedEvent.emit();
console.log("Quit place mode and sent WorldPlaced event");
} else {
console.log("No Anchor ID received");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment