1 (edited by moonflow123 2022-04-11 07:16:22)

Topic: Adding an Image to the Tile just like Draw() method on OnlineMapsDraw

Hi, is there any change or script that I can use to add a GameObject or Canvas into the map just like the Draw() method?? I wanted to add the GameObject so that it can act like a drawing, in which when I zoom, the Object size and position will not follow the camera but the size and position in which I draw or instantiate it in the OnlineMaps Tile.

Re: Adding an Image to the Tile just like Draw() method on OnlineMapsDraw

Hello.

Subscribe to OnlineMaps.OnChangePosition and OnlineMaps.OnChangeZoom and update the position and scale of your object in the scene or screen.
https://infinity-code.com/doxygen/onlin … 37bdd7bfa1

To convert coordinates to World Position use OnlineMapsControlBaseDynamicMesh.GetWorldPosition.
https://infinity-code.com/doxygen/onlin … 6316068362

If your object is UI element, you can convert coordinates this way:
https://infinity-code.com/atlas/online- … rawer.html

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

3 (edited by moonflow123 2022-04-12 01:36:00)

Re: Adding an Image to the Tile just like Draw() method on OnlineMapsDraw

Thank you, is there any chance there's a script example of it? For the OnChangeZoom and GetWorldPosition

Re: Adding an Image to the Tile just like Draw() method on OnlineMapsDraw

Something like that:

using UnityEngine;

namespace InfinityCode.OnlineMapsSupport
{
    public class UpdateGameObjectPosition : MonoBehaviour
    {
        public GameObject target;
        public double longitude;
        public double latitude;

        private void Start()
        {
            OnlineMaps.instance.OnChangePosition += UpdatePosition;
            OnlineMaps.instance.OnChangeZoom += UpdatePosition;
        }

        private void UpdatePosition()
        {
            target.transform.position = OnlineMapsTileSetControl.instance.GetWorldPosition(longitude, latitude);
        }
    }
}
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.