# WPS does not update the device position while running

**URL:** <https://community.nianticspatial.com/t/wps-does-not-update-the-device-position-while-running/4524>\
**Category:** Bug Reports\
**Created:** [May 9, 2024, 4:02pm UTC](https://community.nianticspatial.com/t/wps-does-not-update-the-device-position-while-running/4524 "2024-05-09T16:02:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tobias\_Reidl](https://sea2.discourse-cdn.com/niantic/user_avatar/community.nianticspatial.com/tobias_reidl/32/1688_2.png) [@Tobias\_Reidl](https://community.nianticspatial.com/u/Tobias_Reidl)\
**Post date:** [May 9, 2024, 4:02pm UTC](https://community.nianticspatial.com/t/wps-does-not-update-the-device-position-while-running/4524/1 "2024-05-09T16:02:18Z")

</div>

When running a simple WPS scene and trying to place multiple objects at different positions using the AR World Positioning Manager and it’s OriginLatitude / Longitude method, the latitude and longitude values will not be updated after the initial start of the app.

Example: I used the script below to spawn cubes with a random material. However when trying to place multiple cubes at different locations, only the very first lat and long values will be used. When I restart the app at a different location, it’s now that different location.

```auto
using System;
using System.Collections;
using System.Collections.Generic;
using Niantic.Experimental.Lightship.AR.WorldPositioning;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
using Random = UnityEngine.Random;

public class PlaceNewObjectInfront : MonoBehaviour
{
    [SerializeField] private GameObject _objectToSpawn;

    [SerializeField] private ARWorldPositioningObjectHelper _positioningObjectHelper;
    
    [SerializeField] private Camera mainCam;

    [SerializeField] private Button placeObject;

    [SerializeField] private ARWorldPositioningManager _positioningManager;

    [SerializeField] private List<Material> _materials;

    private List<GameObject> instantiatedObjects;

   
    
    void Start()
    {
        instantiatedObjects = new();
        placeObject.onClick.AddListener(PlaceDownObject);
        StartCoroutine(PrintPosition());
    }

    IEnumerator PrintPosition()
    {
        while (true)
        {
            Debug.Log("Position is => long :" + _positioningManager.WorldTransform.OriginLongitude + 
                      " lat: " + _positioningManager.WorldTransform.OriginLatitude + 
                      " Alt : " + _positioningManager.WorldTransform.OriginAltitude);

            yield return new WaitForSeconds(.7f);
        }

    }
    
    
    void PlaceDownObject()
    {
        // Vector3 position = mainCam.transform.position;

        GameObject newObject = Instantiate(_objectToSpawn);
        newObject.GetComponent<MeshRenderer>().material = _materials[Random.Range(0, _materials.Count-1)];

        newObject.name = $"{newObject.name} {instantiatedObjects.Count}"; 
        instantiatedObjects.Add(newObject);
        
        var lat = _positioningManager.WorldTransform.OriginLatitude;
        var longitude = _positioningManager.WorldTransform.OriginLongitude;
        var altitude = 0;
        
        _positioningObjectHelper.AddOrUpdateObject(newObject, lat, longitude , altitude , Quaternion.identity );
        Debug.Log("(NO DEBUG) Adding Object " + newObject + " at Latitude:" + lat + " Longitude: " + longitude + " Altitude: " + altitude);
        
    }
}

```

---

<div class="post-metadata">

**Author:** ![JoshM](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@JoshM](https://community.nianticspatial.com/u/JoshM)\
**Post date:** [May 10, 2024, 7:17pm UTC](https://community.nianticspatial.com/t/wps-does-not-update-the-device-position-while-running/4524/2 "2024-05-10T19:17:08Z")

</div>

Hello! The reason it isn’t currently working is because you are sending the origin’s latitude and longitude as the update location for your object. Are you trying to spawn a WPS Object when a user clicks on the screen? If so you’d have to derive the longitude and latitude from the click position and pass that in as the parameters for the AddOrUpdateObject Method.

---

<div class="post-metadata">

**Author:** ![Tobias\_Reidl](https://sea2.discourse-cdn.com/niantic/user_avatar/community.nianticspatial.com/tobias_reidl/32/1688_2.png) [@Tobias\_Reidl](https://community.nianticspatial.com/u/Tobias_Reidl)\
**Post date:** [May 11, 2024, 8:55am UTC](https://community.nianticspatial.com/t/wps-does-not-update-the-device-position-while-running/4524/3 "2024-05-11T08:55:26Z")

</div>

But shouldn’t the origin be the current position of the user? So e.g. I place a cube at my position then walk down the street and click place again, shouldn’t the origin position have changed to my new location and place the cube there?

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/niantic/user_avatar/community.nianticspatial.com/system/32/13_2.png) [@system](https://community.nianticspatial.com/u/system)\
**Post date:** [May 12, 2024, 9:57am UTC](https://community.nianticspatial.com/t/wps-does-not-update-the-device-position-while-running/4524/4 "2024-05-12T09:57:22Z")

</div>

This topic was automatically closed 2 hours after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![JoshM](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@JoshM](https://community.nianticspatial.com/u/JoshM)\
**Post date:** [May 13, 2024, 8:01pm UTC](https://community.nianticspatial.com/t/wps-does-not-update-the-device-position-while-running/4524/5 "2024-05-13T20:01:42Z")

</div>

If you are looking to track the current position of the user, I can recommend accessing the \*\*ARWorldPositioningCameraHelper \*\*script. It tracks the current longitude and latitude of the camera which might be of better use to you. The origin is simply the origin of the world coordinate system.
