zooming into specific point on the map. Unity. GoogleAPI

March 27, 2018, at 08:26 AM

I'm making a mobile app on Unity, I know that to zoom into the map I need to calculate that new location using the mouse's coordinates, and then update the lat and lon on that point.

I have no idea how to do this. Well I do, I think but it's not working.

    using System.Collections;
    using UnityEngine;
    using UnityEngine.UI;
  public class GoogleAPI : MonoBehaviour
   public string url;
public RawImage img;
public float lon;
public float lat;
public int zoom;
public int mapHeight;
public int mapWidth;
public int scale;
LocationInfo li;
public enum mapType { roadMap, satelite, hybrid, terrain };
public mapType mapSelected;
private IEnumerator Map()

    url = "https://maps.googleapis.com/maps/api/staticmap?center=" + lat + "," + lon +
        "&zoom=" + zoom + "&size=" + mapHeight + "x" + mapWidth + "&Scale=" + scale
        + "&maptype=" + mapSelected +
        "&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614," +
    WWW www = new WWW(url);
    yield return www;
    img.texture = www.texture;

private void Start()
    img = gameObject.GetComponent<RawImage>();
    lat = Input.mousePosition.x;
    lon = Input.mousePosition.y;
    Debug.Log(lat + "\n" + lon);

public void ZoomUp_Click()
public void ZoomDown()

Obviously, it doesn't work. Am I on the right track with Input.mousePosition.x/y? Also I have 2 buttons on the map, up and down with the idea of zooming up and down 1 if the button is clicked. Again, am I close?


Rent Charter Buses Company
Kotlin singleton getter in ViewModel

Kotlin singleton getter in ViewModel

I'm studying Android Architecture ComponentsHow to implement singleton getInstance() method using Kotlin ? I did this using Java-like style (getLocation), but it is not kotlin-like

Login app can not login to MySQL database in server

Login app can not login to MySQL database in server

My problem is the app login screen return just only this message "Something Went Wrong", and I upload all the PHP file and I create the database in the online server I'm just getting this message and no login at allHow to solve it? Even it is not work in local server...

Build error when trying to build unity VR app

Build error when trying to build unity VR app

Please help me debug these errorsCannot seem to resolve these issues after researching

MSAL not redirecting to Android app

MSAL not redirecting to Android app

I'm playing around with MSAL (Microsoft Identity Client) preview 11