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.

Question Rotate with tracked image

Discussion in 'AR' started by douglassophies, Jun 18, 2021.

  1. douglassophies

    douglassophies

    Joined:
    Jun 17, 2012
    Posts:
    141
    I have scoured the internet and it seems, image tracking with rotation should be as simple as tracking the position. I use the below code.

    Code (CSharp):
    1.       instantiatedARPrefab.transform.position = trackedImage.transform.position;
    2.         instantiatedARPrefab.transform.rotation = trackedImage.transform.rotation;
    The position alone works but if i add rotation, everything hovers above the tracked image and at a slight angle.

    My prefabs have a position and rotation of 0 with a child object that is given a personal position and rotation. The idea being that i can set the default facing and position offset.
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,744