using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class RtkPos : MonoBehaviour { /// /// 显示物体 /// public List list_Obj; /// /// 根据实地GPS数据转化位置信息 ( 与 List_Obj 对应) /// public List list_Pos; public List list_Box; public Text text; /// /// 根据玩家传输进来的Gps 推算出 物体位置 /// /// public void SettingPos( Vector2 playerGps ) { if(list_Pos.Count!=list_Obj.Count) { Debug.LogError(" RTK版本 提供的物体和提供的坐标数量不符 "); return; } if (API_SVR.GetHead()!=null) for (int i = 0; i < list_Obj.Count; i++) { Vector2 diff = list_Pos[i] - playerGps; Vector3 playerPos = API_SVR.GetHead().position; Vector3 pos = new Vector3(playerPos.x + diff.x, list_Obj[i].position.y, playerPos.z + diff.y); list_Obj[i].position = pos; list_Box[i].position = pos; //text.text = pos.ToString(); Debug.Log(pos); } } }