Question
How can I programmatically reset the Magic Leap 2's origin coordinates to 0,0,0? The device automatically sets its origin at startup and after tracking loss, but I need to trigger this reset through code.
TryRecenter() and similar XR calls are designed for VR platforms to reset the user's "forward" direction or "floor level." On Magic Leap, the spatial coordinate system is AR-like, defined relative to the environment. Instead of altering the global origin (0,0,0), use a parent transform like XR Origin or ARSessionOrigin:
Capture the current device position to "reset" the origin.
Store this offset as the "new zero."
Example:
var xro = FindObjectOfType<Unity.XR.CoreUtils.XROrigin>();
xro?.MoveCameraToWorldLocation(Vector3.zero);
xro?.MatchOriginUpCameraForward(Vector3.up, Vector3.forward);
This approach redefines app content alignment relative to the global origin without modifying it.