Search Unity

Question Was the code for the "Dealing with Scale in AR" blog post ever released?

Discussion in 'AR' started by gersart, Jul 30, 2022.

  1. gersart

    gersart

    Joined:
    Feb 20, 2017
    Posts:
    9
    https://blog.unity.com/technology/dealing-with-scale-in-ar

    I was intrigued by this post for the idea of moving the camera to affect the scene of an AR app without changing the elements themselves, mostly as a solution for preventing objects that have been scaled from floating.

    This is for an app that lets one 'place' a building model on the ground and 'enter' it by scaling it larger so the user can experience some element placed inside (clouds, animated objects, forests, etc).

    Right now when I use pinch-to-scale the object floats above the surface, similar to how they do in the SketchFab app. I suspect this may be because they are scaled too large for the surface they are placed upon? Moving the camera instead of scaling the object may help, but having the code from this blog post would very handy.

    In the Mixtures of Scale it has a link but it is a 404 error. There is also a suggestion to "See the DemoGUI.cs component for a code example." but I have not been able to find this file online.
     
    Last edited: Jul 30, 2022
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,145
    Last edited: Aug 1, 2022
  3. gersart

    gersart

    Joined:
    Feb 20, 2017
    Posts:
    9
    Thank you very much.

    Hopefully I can find some insight into the two-camera scaling in there.

    Is there a version of the code where the Recording Session works? the button is always greyed out when I build, and there is an error warning message saying "ARCoreSessionRecording.unity is missing or there is no script is attached"
     
  4. gersart

    gersart

    Joined:
    Feb 20, 2017
    Posts:
    9
    @KirillKuzyk thank you for the code. I have found that the scale slider works best when you reverse the min/max scale values, so moving left shrinks the object, and moving right makes it larger.
    Also limiting the planes detected to JUST horizontal makes it less confusing, since touching the scale bar may place the item on a vertical surface.

    This version also is based off ARSessionOrigin and AROrigin instead of XROrigin like the more modern code. It also uses MakeContentAppearAt, which isn't available in XROrigin (part of my frustrations yesterday)

    Any word on when MakeContentAppearAt will be implemented in XROrigin, as asked by this person in February, or should I continue using the Samples for 4.2?

    https://forum.unity.com/threads/mis...-arsessionorigin-makecontentappearat.1239838/

    While coding yesterday with the latest version I tried using MakeContentAppearAt and got an error that AROriginSession was deprecated, use XROrigin, and when I made the change, the error Origin has no MakeContentAppearAt (paraphrasing here). That Method looks really useful.
     
    Last edited: Aug 1, 2022
    KyryloKuzyk likes this.
  5. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
    KyryloKuzyk likes this.