Using SpaceOrigin as "default" Anchor

Hey all,

I'm fairly new to the MagicLeap and just wanted to ask if I'm fundamentally misunderstanding something.

What I'm trying to do is to shift the user's position within Unity so that Unity's origin equals the localized space's origin if the device is localized into any space.

As a first step I'm just spawning a simple object at the SpaceOrigin coordinates in Unity. Since Unity's origin is the same as the device's origin, I thought this would lead to the object being positioned at the same point in Actual Space regardless of where I boot the device. Sadly, this is not the case and I think I'm not "translating" the space coordinates correctly into Unity coordinates.

If anyone can point me to my error here, I'd be immensely greateful. Otherwise there's a few basic assumptions on SpaceOrigin that I'd like confirmation on:

  1. Is the SpaceOrigin persistent - in Actual Space - for each Space?

  2. Where is the SpaceOrigin of a space located? The geometric middle of the Space? The position where the scan was initialized? Somewhere else?

  3. The SpaceOrigin information is stored as "relative to the world origin". How does this relation look like? Are the values calculated within the space's coordinate system or within the world's coordinate system?

  4. Is there a difference between ML's coordinate system and Unity's? Unity uses (x,y,z) to be (right,up,forward). Is it the same for Magic Leap internal data?

Thanks in advance.

Hey @BOSTER_HB , couple questions but can you confirm which SDK version / OS version you are on and how you are checking if the device is localized into the space before the queries? Your questions imply you have a good understanding of the system if your device is currently localized but here are my answers as follows:

  1. When localized the queried value for Space Origin should reflect where in the headpose session (world coordinates) that spaceorigin is in the real world.
  2. SpaceOrigin is roughly where the scan was initiated in the space.
  3. The origin is for the space's coordinates system but converted to world coordinates when queried.
  4. We use RDF internally, RUB in our ML CAPIs and unity uses RUF :smiley: As mentioned in point 3 we convert it for you when you query.

I suspect the missing piece is checking the localization status and making sure you are localized before the query. If that is not the case then it might be a bug and we can spend some time unpacking it.

1 Like

Thank you for your reply!

It was indeed an issue with the coordinate systems and trying to use the supplied RUB of SpaceOrigin in Unity's RUF. Multiplying the z component with -1 made it work flawlessly.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.