Search Unity

WorldMapping and MakeContentAppearAt clarification

Discussion in 'Handheld AR' started by OlivierHoel, May 24, 2019.

  1. OlivierHoel


    Dec 15, 2017
    Hi !

    TL;DR: what does "relative to the Camera" really means in the description of the rotation parameter, in the MakeContentAppearAt documentation ? How/Is ARSessionOrigin updated after worldmap has been loaded and mapped ?

    I'm using the new ARFoundation (and ARKit) to do a simple markerless, persistent, AR visualisation experience and I'm getting trouble having my 3D model aligned properly...

    Here is my workflow:
    - Step 1: run an AR session and "scan" the environment, then save all points and detected planes into a worldmap file (arkit feature). Manually position a specific ARReferencePoint in the environment (instantiating a frame reference prefab for debugging, e.g. a cube with visual x,y,z axis). NB: this is also saved into the worldmap file.
    - Step 2: in the editor, add reference prefab to a virtual model, place and orient it.
    - Step 3: run an AR session loading the previously created worldmap. Wait for ARKit to "map" the world then load virtual model and place it and orient it so that both reference prefab (the one created from the worldmap and the one present in the virtual model) match position and orientation. Thus virtual model is aligned to real world.

    For the last part, I'm using ARSessionOrigin.MakeContentAppearAt() function, passing my 2nd reference prefab as first parameter, and my ARReferencePoint for position and orientation. However, ARSessionOrigin.MakeContentAppearAt documentation specify that rotation is relative to the Camera. What does it mean exactly ? Do you have to compute another rotation from my ref point ?
    My virtual model is almost placed correctly (some drifting and location approximation when resolving worldmap I believe) but orientation is not really accurate. Using my cube-axis prefab for debug, I can see that both are placed at the same position but orientation is not matching exactly, and so my model is not aligned with real-world...

    Also I couldn't find any information about how ARSessionOrigin is affected after worldmap is loaded and mapped to current session...

    Thanks for insights!
    -- Olivier