Search Unity

  1. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Resolved 3D model misplaced on first-frame tracked

Discussion in 'Unity MARS' started by Ricardotlpz, Aug 26, 2021.

  1. Ricardotlpz

    Ricardotlpz

    Joined:
    May 17, 2021
    Posts:
    54
    Hey there! I have noticed that if we load a scene and the first thing that is present on the camera is the ImageMarker, the 3D model is placed (geographically) where the mobile device is. How could we solve this? Is this a bug?


    Here's my hierarchy. We're downloading the assets used on the ImageMarker using Addressables.
    upload_2021-8-26_13-44-6.png
     
  2. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    87
    Is the camera tracking correctly when this happens (i.e. does other content like a plane visualizer appear correctly)?

    And I assume you don't have any odd transforms on the marker or its children?

    If you can share the contents of the inspector on the marker that might help, or even better the project via a bug report.
     
  3. Ricardotlpz

    Ricardotlpz

    Joined:
    May 17, 2021
    Posts:
    54
    Hey there! Yes, it does work correctly in that case. I do not have what I assume are odd transforms both on marker and child (I'm just using this "MarkerHolder" to anchor the addressable prefab I'm downloading).

    I have submitted the project through a bug report for you to take a look :)
    Case 1361205
     
    mtschoen likes this.
  4. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    87
    Got it.

    Trying out your scene I suspect this may be an unexpected consequence of setting the world scale on the MARS Session.

    Not to say there isn't a bug, just it's a little late on a Friday night for me to figure out the geometry of what it should be doing; but the marker tracking seems to be working fine. I'll look further into it next week.
     
    Ricardotlpz likes this.
  5. Ricardotlpz

    Ricardotlpz

    Joined:
    May 17, 2021
    Posts:
    54
    Appreciate you took a look even on friday night , any updates?
     
  6. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    87
    Are you seeing the content jump or drift, or does it start out in the wrong place?
     
  7. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    87
    I would also try turning on "Follow Match Updates" on the Set Pose Action on your marker and see if that helps.
     
  8. Ricardotlpz

    Ricardotlpz

    Joined:
    May 17, 2021
    Posts:
    54
    Content does not jump nor drift, it starts on the wrong place and doesn't follow the marker at all. Folow Match Updates didn't seem to help
     
  9. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    87
    Couple more ideas:

    If you just put a sphere in the scene under the MarkerHolder does that track correctly?

    If you are instantiating something at runtime and then putting it under the proxy then you'll need to make sure to clear the local transform. It looks like at JSONToAddressables.cs:95 you are assigning the transform.parent, which will preserve the world position - if the game object instantiated at the origin it will stay there. Use Transform.SetParent() to avoid this.
     
  10. Ricardotlpz

    Ricardotlpz

    Joined:
    May 17, 2021
    Posts:
    54
    Thank you! I think you mean 195 instead of 95. We're working on a solution now. I'll be back with some news
     
  11. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    87
    This is the line:
    Code (CSharp):
    1.                     asset.transform.parent = markerParent.transform;
    2.  
     
  12. Ricardotlpz

    Ricardotlpz

    Joined:
    May 17, 2021
    Posts:
    54
    A little bit of tweaking and it worked! Thank you so much! Really appreciate your help and availability here on the forums.

    Code (CSharp):
    1.                     asset.transform.SetParent(markerParent.transform, false);
    2.  
     
    CiaranWills and mtschoen like this.
unityunity