Search Unity

TrackedPoseDriver causing ViewportToScreenPoint to be inaccurate

Discussion in 'AR' started by JoeGrainger, Jul 11, 2019.

  1. JoeGrainger

    JoeGrainger

    Joined:
    Oct 20, 2012
    Posts:
    19
    Hey,

    I can't seem to find an answer to this on the forums, but basically I'm using the following setup:

    Unity 2018.3.6f1
    AR Foundation 1.5.0-preview.2
    ARKit 2.1.0-preview.5

    It doesn't seem to matter what I do, calling Camera.ViewportToScreenPoint in Update, LateUpdate, OnGUI, OnPreRender, OnPostRender, OnRenderObject - the alignment on the canvas is always off, almost lerping towards the target position.

    Switching TrackedPoseDriver.updateType from UpdateAndBeforeRender to Update fixes this issue, but makes the actual AR tracking super inaccurate.

    I've also looked at changing the script execution order, but because TrackedPoseDriver is a built in component I can't modify this.

    Any help would be appreciated!

    Thanks,
    Joe
     
  2. JoeGrainger

    JoeGrainger

    Joined:
    Oct 20, 2012
    Posts:
    19
    So for me the fix ended up being a combination of calling the positional update code in LateUpdate & also on the Application.onBeforeRender event.