Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

scale of objects calculated according to the screen

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

  1. joaovictorpac

    joaovictorpac

    Joined:
    Jun 10, 2018
    Posts:
    9
    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:
    62
  3. Most_Incredible

    Most_Incredible

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

    bradweiers

    Unity Technologies

    Joined:
    Nov 3, 2015
    Posts:
    44
    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