Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Scaling with ARFoundation

Discussion in 'AR' started by tdmowrer, Aug 5, 2018.

Thread Status:
Not open for further replies.
  1. Deleted User

    Deleted User

    Guest

    There was some old\depricated plugin which made it work in editor indeed. But now its outdated\or early access and not really working as far as i know.
     
  2. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    416
    Hi,

    I see... let's hope they provide something because right now, it's very frustrating especially when you want to explore the api and do more advanced use of AR experience.

    Bye,

    Jean
     
  3. GeckoTrader

    GeckoTrader

    Joined:
    Nov 24, 2016
    Posts:
    8
    Thank you @tdmowrer for your post.

    Will this impact "Collaborative participants" functionality, which uses ARAnchor and reports back both participants and ARAnchors?
     
  4. rajshekarreddy

    rajshekarreddy

    Joined:
    Sep 20, 2018
    Posts:
    8
    How do I do this the traditional way using lean touch?
     
  5. vishwah13

    vishwah13

    Joined:
    Jun 22, 2019
    Posts:
    4
    i have a problem if i scale the AR Session origin it cant detect the Plane any more
     
  6. gaurav_u_gupta

    gaurav_u_gupta

    Joined:
    Mar 4, 2020
    Posts:
    4
    I am struggling in it since last few days. if somebody can suggest anything it will be helpful.
    I have a steady model on AR Plane. and I want to scale it down after model is detected. When scaledown button is pressed following code is invoked:

    sessionOrigin.transform.localScale = Vector3.one * newval;
    sessionOrigin.MakeContentAppearAt(shadowPlane.transform, new Vector3(0,0,0));
    worldMap.setAnchorPoint(Vector3.zero, Quaternion.Euler(new Vector3(0.0f, 0.0f, 0.0f)));

    This doesn't work. and everthing remains as it is. model doesn't change at all.
    However, moment I change first line from localScale to position as :
    sessionOrigin.transform.position = Vector3.one * newval;

    it works and model size reduces. But problem is model looses its primary position and keeps changing the location at every button click. And I assume its because I am changing the position in code. But any suggestion what is going wrong ? why am I not able to use localScale ? Because my requirement is to change size not position.
     
  7. Prathamesh_Prasade

    Prathamesh_Prasade

    Joined:
    Dec 5, 2017
    Posts:
    10
    I have 2 copies of a Cube in my AR scene, Cube1 and Cube2. Cube1 is child of the ARSessionOrigin>ARCamera>Cube1 and Cube2 is not child of ARSessionOrigin. When I detect a plane, I place Cube2 at the hit pose using MakeContentAppearAt(). I have implemented scaling using the slider as shown in AR Foundation Samples. In my case the ARSessionOrigin scale varies from 0.5 to 1.5. The problem is I am not able to scale Cube1 exactly to match the size of Cube2 when Cube2 is scaled using the slider. Any suggestions how I can keep matching sizes of both cubes even after using the scaling slider. I tried to change the local scale of Cube1 but it never matches exactly with Cube 2.
     
  8. mohanyadav

    mohanyadav

    Joined:
    Jan 4, 2016
    Posts:
    1
    Thank you @tdmowrer
    Came across the forum post while I was searching for how to rotate terrain in AR. Helped me achieve the result that I wanted :)
     
  9. Prathamesh_Prasade

    Prathamesh_Prasade

    Joined:
    Dec 5, 2017
    Posts:
    10
    @tdmowrer can you please help me out. I am stuck on this from quite a long time.
     
  10. mwlazlo885

    mwlazlo885

    Joined:
    May 17, 2018
    Posts:
    6
    hey! is there a method to scale ArSession with fingers?
     
  11. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    612
    Try AR Foundation Editor Remote.
     
    bostonvaulter and KirillKuzyk like this.
  12. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    416
    Cool,

    How did I missed that! :)

    Another typical case of "It should be integrated by Unity" ...

    Bye,

    Jean
     
    KirillKuzyk likes this.
  13. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    612
    In MARS (paid) Unity has Remote Testing, but AR Foundation Editor Remote is cheaper.
     
    KirillKuzyk likes this.
  14. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    416
    Hi,

    well, Mars is not exactly like that.

    Bye,

    Jean
     
  15. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    612
    @tdmowrer Hi, if I use next code then I have inverted scaling factor.
    If the factor is greater, then the visual scale of the game world is smaller.

    1. Why is it working in such a way?
    2. We have MakeContentAppearAt() method. Why we don't have Scale() method, and we need to use default way to scaling? I guess, that it might be a little confusing.
    Code (CSharp):
    1. arSessionOrigin.MakeContentAppearAt(gameWorldParent, pos);
    2.  
    3. yield return null;
    4.  
    5. arSessionOrigin.transform.localScale = Vector3.one * factor;
    6.  
     
  16. KirillKuzyk

    KirillKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    953
    I agree that inverted scaling may be counter-intuitive. The scale applied to ARSessionOrigin actually scales all tracked objects (planes, point clouds, etc.). So a better way to think about scale is that you're scaling an entire world while your virtual object stays the same size. This means if you make an entire world twice bigger, the apparent size of your virtual content will become twice smaller.
     
    makaka-org likes this.
  17. dogsaregreat

    dogsaregreat

    Joined:
    Sep 5, 2018
    Posts:
    21

    could this setup make sense in a situation where the environment is mapped with a mesh, with several environmental objects who's scale needs to be fixed but i want to scale 1 object?
     
  18. Kiraaa23

    Kiraaa23

    Joined:
    Nov 30, 2018
    Posts:
    2
    I was struggling with pixelated shadows in my ARScene, on some research i came to know that it was because of the scaling thing, the objects were becoming too tiny to cast good shadows. This thread really helped me a lot to understand Arfoundation workflow and ARSessionOrigin.MakeContentAppearAt did the trick for me. Thank You
     
    KirillKuzyk and makaka-org like this.
  19. 52cwalk

    52cwalk

    Joined:
    Nov 23, 2013
    Posts:
    15
    I am facing the same issue when using the 3d Object recognition, , it has no effect when using the ARSessionOrigin transform scale and MakeContentAppearAt.
    Why?
     
  20. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    324
    Would you please start a new thread and describe your problem in detail?
     
    makaka-org likes this.
Thread Status:
Not open for further replies.