mapbox-developer-group / Mapbox-Tech-Q-A

在提问之前请自行查看文档哦,养成好习惯:https://docs.mapbox.com/
32 stars 1 forks source link

使物体移动到指定经纬度处,物体移动到了其他地方 #63

Open llliao104 opened 4 years ago

llliao104 commented 4 years ago

我遇到的问题

调用GeoToWorldPosition这个方法,输入经纬度,为什么点没有移动到相应的位置呢,我输的经纬度对应的是New york,但是它移动到其他地方去了

我遇到的问题截图

public class moveWaypoint2 : MonoBehaviour { public InputField Position; private Vector2d getLatlon; private Vector3 target; public float speed; [SerializeField] AbstractMap map;

// Update is called once per frame
void Update () {
    Position = GameObject.Find("inputTest").GetComponent<InputField>();
    getLatlon = Conversions.StringToLatLon(Position.text );
    target=map.GeoToWorldPosition(getLatlon);      
    gameObject.transform.localPosition = Vector3.MoveTowards(gameObject.transform.localPosition, target, speed * Time.deltaTime);        
}

该问题的类别

Unity