Wayspot Anchors VPS template not localising/session not initialising?

Include the following details (edit as applicable):

  • Issue category: VPS
  • Device type & OS version: Android 10
  • Host machine & OS version: 7Windows 7
  • Issue Environment : On Device
  • ARDK version: 2.1.0
  • Unity version: 2021.3

Description of the issue:

Hi should the template provided for VPS work in real life wayspots? It works in the mock environment in Unity but when i build to my phone, the session doesnt initialize and the localisation fails…

Is real world use outside the scope of the template and its just to show how persistent anchors work (in mock mode)?

Other templates are building successfully on my device…

Thanks for any pointers!!

Hello TestingTesting123,

The template for VPS does work with real life wayspots, though takes more setup than simply loading the scene and pressing play. Please note only approved activated wayspots will localize. Please see the coverage API for activated locations. And for more information on setting up VPS, as well as reasons localization may fail, please check the lightship.dev articles on VPS.

Hi thanks for the reply.

Well I am looking to build and test something I can see working at a local activated location.

Will this guide result in something I can see working please?

Grateful on any pointers on what ‘more setup’ means in this context please?

Hi,
I also run into troubles with this template but was able to make it workig with two fixes which I would like to share:

  • add Fine and Coarse Location permissions to the Android Permission Requester component of ARSceneManager
  • The TransformUpdated event handler was not called on my device at all for some reason (but worked in the mock mode). So I changed the logic a bit and registered first for StatusCodeUpdated and then, after checking if wayspotAnchorStatusUpdate.Code == WayspotAnchorStatusCode.Success, registered to the TransformUpdated event

Hope it helps.
BTW Niantic Guys: fixing the template would be great if my observations are correct. Thanks in advance!

Hi,
please could you specify where to change the logic you suggest? Thanks

Massimo

Add this lines in the class declaration:

        // this already exists
        private readonly Dictionary<Guid, GameObject> _wayspotAnchorGameObjects =
        new Dictionary<Guid, GameObject>();

        //this is new
        private readonly Dictionary<Guid, IWayspotAnchor> _wayspotAnchors =
        new Dictionary<Guid, IWayspotAnchor>();

and put this code from below replacing the current methods:

        private void CreateAnchorGameObjects(IWayspotAnchor[] wayspotAnchors)
        {
            foreach (var wayspotAnchor in wayspotAnchors)
            {
                if (_wayspotAnchorGameObjects.ContainsKey(wayspotAnchor.ID))
                {
                    continue;
                }
                var id = wayspotAnchor.ID;
                wayspotAnchor.StatusCodeUpdated += HandleWayspotAnchorStatusUpdated;
                _wayspotAnchors.Add(id, wayspotAnchor);


                var anchor = Instantiate(OHcontroller.ObjectHolder);
                anchor.SetActive(false);
                anchor.name = $"Anchor {id}";
                _wayspotAnchorGameObjects.Add(id, anchor);
            }
        }

        private void HandleWayspotAnchorTrackingUpdated(WayspotAnchorResolvedArgs wayspotAnchorResolvedArgs)
        {
            var anchor = _wayspotAnchorGameObjects[wayspotAnchorResolvedArgs.ID].transform;
            anchor.position = wayspotAnchorResolvedArgs.Position;
            anchor.rotation = wayspotAnchorResolvedArgs.Rotation;
            anchor.gameObject.SetActive(true);
        }

        private void HandleWayspotAnchorStatusUpdated(WayspotAnchorStatusUpdate wayspotAnchorStatusUpdate)
        {
            if (wayspotAnchorStatusUpdate.Code == WayspotAnchorStatusCode.Success)
            {
                var wayspotAnchor = _wayspotAnchors[wayspotAnchorStatusUpdate.ID];
                wayspotAnchor.TransformUpdated += HandleWayspotAnchorTrackingUpdated;
            }
        }       

Hope it helps and looking forward for your feedbackl