Search Unity

AR Camera Raycast Inaccurate?

Discussion in 'AR' started by oleyb, Aug 9, 2018.

  1. oleyb

    oleyb

    Joined:
    Nov 8, 2012
    Posts:
    15
    I have a canvas UI with the image of a reticle at the center of my screen to aid in aiming. When I send a raycast from the position of the camera in it's forward direction, the ray seems to be firing from just above the reticle image rather than at it's center when run on a device. It appears offset vertically from center by a different amount depending upon whether I use an iPhone 7+ or an iPad.

    When I test the exact UI in the same scene in the editor with a non-arkit managed camera, the raycast correctly fires from the center of the reticle. If I use the ARKitRemoteConnection, the ray fires in the same offset way as when run directly on the device.

    I'm going crazy. Does anyone have any ideas?

    Not doing anything crazy with the raycast:
    Code (CSharp):
    1. Physics.Raycast(mainCamera.transform.position, mainCamera.transform.forward, out selectionHit, 100)