Search Unity

Question Placing an AR model on it's real object

Discussion in 'AR' started by argame42, Apr 12, 2022.

  1. argame42

    argame42

    Joined:
    Sep 5, 2017
    Posts:
    2
    Hello everyone
    I have been working on a project that I have to place tumors models on a real 3d printed skull. I tried using a QR code attached to skull as an target for AR foundation Image Tracking and then offset the AR model onto the real skull but the results aren't good. When I move camera the model moves with camera (I think that is normal behavior considering that I am tracking QR code) so the tumors position changes and does not show the real tumors positions. Is there a way to place model in an exact position and prevent them from moving?
    I used Vuforia model target for this purpose and it did the job but I can't use it for actual project and must use AR Foundation. also My target devices are android devices so I can't use AR foundation 3D Object tracking.

    I appreciate any help and advice
     
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
  3. argame42

    argame42

    Joined:
    Sep 5, 2017
    Posts:
    2
    Thanks for the advice I tried it and it had acceptable results. but I got another problem I use image tracking to find QRCode and use Raycast from tracked QRCode position to find Point Clouds on QRCode. Models will be placed with this method but I see some inconsistencies. In different runs it seems AR foundation places model in different position (small position differences) and rotation (I used quaternion.identity for models). I use AR Foundation 4.0.12 with unity 2020.2.7f
     
  4. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
    Raycasts against a point cloud return collisions against individual points in a cloud. Points generated in a point cloud might be at different positions based on a wide range of factors, and point cloud generation is not deterministic.
     
    KyryloKuzyk likes this.
  5. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
  6. Finn_Nua

    Finn_Nua

    Joined:
    Mar 27, 2023
    Posts:
    9
    I've tried doing this, but every time I attach an anchor to the instantiated prefab, it jumps to the app launch site rather than the detected image position
     
  7. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
    Are you adding an ARAnchor component to the GameObject that already contains an ARTrackedImage component? You should not mix and match trackables on the same GameObject. Instead, create a new GameObject, move it to the position and rotation of the tracked image, then add an an ARAnchor to that GameObject. At that point you can disable image tracking in your app if you no longer need it.