Search Unity

How to place the AR in front of the cam?

Discussion in 'AR' started by zyonneo, Nov 6, 2019.

  1. zyonneo

    zyonneo

    Joined:
    Apr 13, 2018
    Posts:
    386
    I am doing an image tracking project.After the corresponding image is tracked the model shows on the camera.The issue is the position of the model is coming with respect to AR camera position when the app was opened not to the position when AR camera is tracking the image.
    For example-If I open the app then turn 180 degrees around and track image the model will be coming on my back.I need it to come in front when I track the image.When image is tracked I just make visiblity of the model to true.

    Code (CSharp):
    1.  
    2.                 Showprefabs.SetActive(true);
    3.                 Vector3 campos = Arcam.transform.position;
    4.                 //Giving -1 in y for coming down and z = 5 to come in front of camera.
    5.                 Showprefabs.transform.position = new Vector3(campos.x, -1f, 5f);
    6.