Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

AR Scaledown non-moving prefeb model : sessionOrigin.transform.localScale not working

Discussion in 'AR/VR (XR) Discussion' started by gaurav_u_gupta, Aug 28, 2020.

  1. 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.