Search Unity

How to find the exact distance between the real world object and AR Camera?

Discussion in 'AR/VR (XR) Discussion' started by soorya696, Sep 30, 2019.

  1. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    71
    I want to place the GameObject above the real-world object (for. eg. smoke effect over a coffee cup). how to achieve this?
     
  2. zakpacha

    zakpacha

    Joined:
    Nov 28, 2016
    Posts:
    12
    anchor a gameobject onto your real world object and add the smoke as a child to that gameobject. Raise the smokes position Y value as you please.
     
  3. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    71
    how to know the exact depth of the real-world object from the ar camera?
    I need real world co-ordinate to create the anchor right?
     
  4. zakpacha

    zakpacha

    Joined:
    Nov 28, 2016
    Posts:
    12
    Create an anchor on whichever plane you detect using your AR. Calculate distance of the spawned anchor transform position and the cameras transform position.