Search Unity

Change icon based on user proximity in AR Foundation?

Discussion in 'AR/VR (XR) Discussion' started by ethanproia, May 28, 2019.

  1. ethanproia

    ethanproia

    Joined:
    Feb 27, 2019
    Posts:
    7
    Hello all,

    Just started working with AR Foundation. Would like to create an app with plane detection where the user can tap to place an icon and have the icon change based on the user's distance to/from the placed icon.

    I have a basic AR Foundation framework running with plane detection and object placement working but could use some help writing a script for getting the object/icon to change based on distance.

    Are there any functions built into AR Foundation that could take a measurement from a tap location?

    Thanks very much for any and all help.
     
  2. milkumich

    milkumich

    Joined:
    May 9, 2019
    Posts:
    2
    From what I understand, as long as the AR Session Origin object is the default scale, one unit in Unity is equivalent to one meter in real life. So you could measure a raycast from the device camera to the surface where the icon would be placed and change the icon's scale based on that measurement.
     
  3. ethanproia

    ethanproia

    Joined:
    Feb 27, 2019
    Posts:
    7

    Awesome, thanks so much. I'll see what I can write today and post some updates.