Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Displaying a 3D model with a fixed real size

Discussion in 'Vuforia' started by rluppino, Dec 20, 2019.

  1. rluppino

    rluppino

    Joined:
    Aug 7, 2017
    Posts:
    2
    [Help Wanted]

    Hi,

    I'm using Vuforia and have a 3D model that needs to be overlayed on a camera scene at a fixed real world size (e.g. 10cm x 10cm) regardless of the size/resolution of the iPad/tablet screen. I have tried obtaining the screen size/resolution at run time and then adjusting the localScale of the model accordingly, and while the size of the model does change, it does not end up at the correct size. I've taken the canvas scaler into account but again, I cannot arrive at the correct size.

    Does anyone have any experience with this and any advice on how to achieve this?

    Thanks
     
    Last edited: Dec 20, 2019
  2. Sika_MC

    Sika_MC

    Vuforia

    Joined:
    Jul 17, 2019
    Posts:
    75
    Hi,
    What feature are you using? Image Targets, Model Targets, Object Targets?

    Is the misalignment between the models noticeable? aka 3-5cm? Would you be able to share a print-screen?

    Thank you.
    Vuforia Engine Support
     
  3. rluppino

    rluppino

    Joined:
    Aug 7, 2017
    Posts:
    2
    Thanks for your reply. The issue has now been solved by obtaining the bounds of the mesh renderer of the game object and then calculating the corresponding screen rect using Camera.main.WorldToScreenPoint. U adjusting the object's localScale according to the size and resolution of the screen of the device that the app is running on.
     
    Sika_MC likes this.
unityunity