Skip to content

XR Anchor

Updated

Pins the entity to a real-world spot.

Type
comp-xr-anchor
Script class
XRAnchorComponent
Per entity
One
Version
1.0.0

Read about it in XR anchors: what it does, how to use it from a script, and examples.

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • XRAnchor::tracked
  • XRAnchor::lost
  • XRAnchor::restored

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(XRAnchorComponent);
if (component) log(component.props);
}