Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    2
    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:
    15
  3. UnityEngineer_India

    UnityEngineer_India

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

    bradweiers

    Unity Technologies

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