Search Unity

WorldAnchor.isLocated property not updated before OnTrackingChanged callback

Discussion in 'AR/VR (XR) Discussion' started by Nakda, May 3, 2017.

  1. Nakda

    Nakda

    Joined:
    Sep 27, 2015
    Posts:
    4
    I did file a bug within the Unity Editor regarding this issue. Ticket is open since March 17th, 2017 but got no answer nor update so far.

    I simply want to notify Unity Editor users about it until it get fixed (or at least documented if that's the intended behaviour).

    The "bug" is related to the WorldAnchor.isLocated property (https://docs.unity3d.com/ScriptReference/VR.WSA.WorldAnchor-isLocated.html).

    When the WorldAnchor is not located, you might want to listen to the OnTrackingChanged event. As soon as it gets fired, the callback provides the subject WorldAnchor and the updated "isLocated" value.
    Thing is, if you bypass the provided value and access directly the property (worldAnchor.isLocated), the wrong value will be returned.

    Indeed, it seems isLocated internal property is updated AFTER the OnTrackingChanged callback gets fired.

    If it is the intended behaviour, I guess it should be mentioned in the documentation to avoid any confusion.

    How to reproduce (Nakda -myself- post): https://github.com/Microsoft/HoloToolkit-Unity/issues/563#issuecomment-287116383


    Tags: HoloLens, VR, WorldAnchor, OnTrackingChanged, isLocated
     
    tvald likes this.
  2. StephenHodgson-Valorem

    StephenHodgson-Valorem

    Joined:
    Mar 8, 2017
    Posts:
    148
    @Akenash, try reposting the the HoloLens forum?
     
  3. tvald

    tvald

    Joined:
    Jul 13, 2018
    Posts:
    10
    Thanks for posting this - it helps to quickly validate that this is a long-standing bug. It's still present in 2018.2.14f1.