Search Unity

Instantiating with the wrong rotation (Augmented Reality)

Discussion in 'AR/VR (XR) Discussion' started by DaPhamius, Jan 23, 2020.

  1. DaPhamius

    DaPhamius

    Joined:
    Jan 19, 2020
    Posts:
    6
    Hey everyone!

    I'm fairly new to AR so I'm experimenting with basic things in AR.

    So far I've managed to spawn things with tapping the mobile screen, but for some reason, the object that is instantiating is facing downwards instead of forward.

    This is my instantiating code:

    Code (CSharp):
    1.    private void Update()
    2.     {
    3.         if(Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began)
    4.         {
    5.             GameObject obj = Instantiate(objectToSpawn, placementIndicator.transform.position, placementIndicator.transform.rotation);
    6.         }
    7.     }
    So far I've tried to change the prefab's X-rotation, the placementIndicator's X-rotation without luck.

    The Object is an .fbx file if it's relevant.

    Hope a kind soul can help a novice on his journey!

    Best regards!
     
  2. Matt_D_work

    Matt_D_work

    Unity Technologies

    Joined:
    Nov 30, 2016
    Posts:
    202
    when you exported the object from your modelling package what was its orientation? can potentially change its axis orientation in the importer.