Search Unity

Question Forcing AR Anchor into plane

Discussion in 'AR' started by Bersaelor, Jul 20, 2022.

  1. Bersaelor

    Bersaelor

    Joined:
    Oct 8, 2016
    Posts:
    111
    Hey there ARFoundation experts!

    using `ARTrackedImageManager` and `ARAnchorManager` I anchor our digital content with the marker, that connects it to the physical content in an exhibition.

    Are there any preferred techniques of telling ARFoundation that my anchor is always either vertical or horizontal, i.e. forcing it into a straight up or flat on the ground rotation?
    Often the phone will detect the image slightly slanted, which shows our content slightly misaligned with the real world sculptures. I know our markers will always be on completely level surfaces, and that the accelerometer in the phones knows where down is, so I was wondering whether we can glue anchors rotation, even if they are initialy slightly slanted.
     
  2. Bersaelor

    Bersaelor

    Joined:
    Oct 8, 2016
    Posts:
    111
    So, in our case all that was needed was fixing some Euler angles:

    Code (CSharp):
    1.         goalRotation = Quaternion.Euler(0f, rot.eulerAngles.y, 0f);
     
    andyb-unity likes this.