Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. 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:
    3
    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:
    30
  3. UnityEngineer_India

    UnityEngineer_India

    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:
    41
    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