Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question 3D Model blocks Camera View on Tracking Lost.

Discussion in 'AR' started by wuannetraam, Jun 22, 2023.

  1. wuannetraam

    wuannetraam

    Joined:
    Oct 29, 2019
    Posts:
    87
    This is a very frustrating problem I am facing right now. I have delivered an AR app for a client where you scan an image and then a 3d model appears on top of the image. It works fine. Now the client put down it's Tablet so the tracking is lost then he picks up the tablet again and then the 3d model is in the middel of the camera so it blocks the cameras view. Now you can not see the camera feed anymore so you have to guess if you are scanning the image correctly again. When the image is scanned the 3d models snaps back to it's original position and everything works fine again.

    When testing this app for the client I never tought of doing something like this but the clients wants this to be fixed.

    I understand why this is happening. When the tracking is lost the camera's position resets to 0,0,0 position. Which is exactly in the middel of my 3d model. I can not offset the 3d model as it should be centered on top of the Image Tracker.

    What would be an "easy" way to fix this?
    Hope someone can help me out with this.
     
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    776
    wuannetraam likes this.
  3. wuannetraam

    wuannetraam

    Joined:
    Oct 29, 2019
    Posts:
    87
    Thank you. I mostly work with Visual Scripting so I am not very experienced with c#. I know the basics. To get the session state and to perform an action where do I do this? Do I need to write a new script for this or change a current one? Hope you can help me out with this.
     
  4. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    776
    @wuannetraam You are the first user on the forums who has asked this question since our latest feature announcement in AR Foundation 5.1 :D! We now support Visual Scripting!

    Here's how you access the Session State: https://docs.unity3d.com/Packages/c...ference/vs-node-on-session-state-changed.html

    Here's the root of the docs hierarchy where you can find all the setup information, etc: https://docs.unity3d.com/Packages/c...manual/visual-scripting/visual-scripting.html

    If you do end up trying this out, we would love to hear your feedback as this is a brand new feature.