Search Unity

scale of objects calculated according to the screen

Discussion in 'AR' started by joaovictorpac, Jun 10, 2018.

  1. joaovictorpac

    joaovictorpac

    Joined:
    Jun 10, 2018
    Posts:
    19
    How to maintain the calculated scale of objects calculated according to the screen size of the device? I would like to make a process that suits any mobile device on which the app was installed. That is, I need a way to identify the size of the device screen and calculate the scale of the object to be represented in augmented reality. Does anyone know if it is possible? Can someone help me? I'm using arcore, but I also use vuforia.
    .
     
  2. Saicopate

    Saicopate

    Joined:
    Sep 25, 2017
    Posts:
    76
  3. Most_Incredible

    Most_Incredible

    Joined:
    Jan 25, 2012
    Posts:
    36
    r you asking for the 3D object size or 2D UI size.?
     
  4. bradweiers

    bradweiers

    Joined:
    Nov 3, 2015
    Posts:
    59
    Here is my recommended solution:
    • Get the position where the scaled object will appear or will be placed
    • Cast a ray from that location upwards, looking for a frustum plane
    • Take that distance and translate it to the height of the object and scale it so that height < ray hit distance
    Let me know if that helps