Search Unity

positioning of prefabs in AR foundation Image Tracking

Discussion in 'AR' started by Lalitsharma81, Aug 8, 2020.

  1. Lalitsharma81

    Lalitsharma81

    Joined:
    Jun 19, 2020
    Posts:
    13
    Hey all

    I am currently working with Image tracking component of ARfoundation and continuously facing this issue

    I want to track a QR code and then load a prefab in a particular orientation wrt to that QR.The problem is whenever i try to set my prefab transform according to the my requirements it does not reflect the same in the app also it resets the transform of my prefab every time and places it in the center of QR.

    I looked over various tutorials on Youtube and didnt find any helpful resource regarding orientation of prefab, all just seem to load the model over the target as it is.

    Is there any way/demonstration to address my problem ? In Vuforia we have an option to place object wrt to Image Target in the unity editor itself but i dont know how to do that here.

    I tried few ways to this and got to know that scaling is working as intended (but i still dont know is the relation between target size and scale of object) but position and rotation are not working.

    Unity 2019.3.12f , ARF = 3.0.0

    Please help !!
     
    kutlumete and dansopanso like this.
  2. dansopanso

    dansopanso

    Joined:
    Jun 14, 2018
    Posts:
    11
    I ran into the same problem and could not find any any solution so far either.

    I tried the AR Foundation Demos Project from Github and it seems as ARTrackedImageManager.cs overwrites the rotation of my prefab. For some reason it expects all images to be positioned on a horizontal plane but when the tracked image is hanging on a wall the prefab starts to turn in wierd ways.

    I'm using Unity 2020.3 (LTS) and ARF = 4.1.5
     
  3. dansopanso

    dansopanso

    Joined:
    Jun 14, 2018
    Posts:
    11
    well as it turns out there was a script called "Number Manager" on the loaded prefab that added a rotation constraint in order to rotate the prefab towards the camera. All i had to do is to deactivate this script and rotate the mesh inside of the prefab. Rotating the prefab itself doesn't have any effect.
     
  4. kutlumete

    kutlumete

    Joined:
    Apr 6, 2021
    Posts:
    1
    Dear Dansopanso, after deleting that piece of code, you were able to instantiate a prefab model at a custom distance to the image ? Thanks in advance !
     
  5. SkullKrusher17

    SkullKrusher17

    Joined:
    Nov 4, 2021
    Posts:
    1
    Where did you find the number Manager script