Resolved VPS anchors jumping around

  • Issue category: VPS
  • Device type & OS version: iPhone 13 Pro - iOS 15
  • Host machine & OS version: MacBook Pro M1, macOS Monterey
  • Issue Environment : On Device
  • Xcode version: 13.4.1
  • ARDK version: 2.1.0
  • Unity version: 2020.3.33

Description of the issue:
When I first localize against a public VPS spot and place an anchor, the anchor is solid and stays perfectly aligned the whole time. But then when I restart the app and restore it, first it’s placed off the original position (by 10-20cm) and then it keeps jumping, trying to align itself as I view the Wayspot from different angles. It often does this repeatedly, often never settling into a fixed position. And sometimes it just ends up jumping between two positions continuously every few frames (see video below).

I based my code on the documentation samples and the VPS dev tutorial video. I tested the VPS Example included in the Unity Examples package and those anchors also jump around quite a bit, but eventually seem to settle, although in the wrong position. And the VPS Voyage app seems the most stable.

What might be going here? I have noticed that periodically I get the following error messages in the console, for all the anchors that I have tried to restore (from other Wayspots). I don’t know why they keep showing up since I only call RestoreWayspotAnchors once:

#Niantic.ARDK.AR.WayspotAnchors.WayspotAnchorService#:WayspotAnchor
has failed: 8bf98f49-0bOd-9cf4-5857-dc72a46a7a09

Here’s the video when it’s constantly jumping back and forth. The semi-transparent cube indicates the actual anchor and the rest is content parented to it.

Hi Julian,

Please try to use VPS Wayspot Anchors to place virtual objects that maintain a consistent, stable pose in the AR environment.

The VPS Wayspot Anchor API maintains a stable pose for Wayspot Anchors by tracking as the user changes position and sending corrected Wayspot Anchor position information.

Please refer to this detail for placing, restoring, and using VPS Wayspot Anchors.

Hope it helps!

Hi Umaiya,

That’s exactly what I am trying to do and that page you linked is what I followed.
I create a Wayspot Anchor and parent other game objects to it. The anchor is stable when I place it, but next time when I resolve it, it keeps jumping around based on the TrackingStateUpdated callback. This is the exact code I am using:

private void OnUpdateAnchorPose(WayspotAnchorResolvedArgs args) {
    if(anchors.ContainsKey(args.ID)) {
        var anchor = anchors[args.ID];

        if(!anchor.initialized)  // this will create the anchor placeholder
             anchor.Initialize(anchorPrefab, args.Position, args.Rotation);
                    
        anchor.transform.position = args.Position;
        anchor.transform.rotation = args.Rotation;
    }
}

I have noticed this error keeps being printed, for all the anchors, multiple such messages for each anchor, even after one of the anchors has resolved correctly. Why is that? Is this normal?

#Niantic.ARDK.AR.WayspotAnchors.WayspotAnchorService#:WayspotAnchor
has failed: 8bf98f49-0bOd-9cf4-5857-dc72a46a7a09

Hi Julian,

This is expected behavior and our team is working on temporal smoothing which should make objects stay in place longer and not jitter.
Currently, OnUpdateAnchorPose** **is called every time we get a new prediction for the anchor, and such slight jumps like in the video are expected. You can try to add smoothing or a threshold on top of this to meet the needs of your game.
For example: You can check the position before and after the update, and if it is <1m difference then don’t apply the new update to keep the object stable.

At this moment we do not have comprehensive guidelines related to it but, for reference, you can take a look at this.
Hope this helps!