1234567891011121314151617181920212223242526272829303132333435363738 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class RtkPos : MonoBehaviour
- {
- /// <summary>
- /// 显示物体
- /// </summary>
- public List<Transform> list_Obj;
- /// <summary>
- /// 根据实地GPS数据转化位置信息 ( 与 List_Obj 对应)
- /// </summary>
- public List<Vector2> list_Pos;
- /// <summary>
- /// 根据玩家传输进来的Gps 推算出 物体位置
- /// </summary>
- /// <param name="playerGps"></param>
- public void SettingPos( Vector2 playerGps )
- {
- if(list_Pos.Count!=list_Obj.Count)
- {
- Debug.LogError(" RTK版本 提供的物体和提供的坐标数量不符 ");
- return;
- }
- 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, 0, playerPos.z + diff.y);
- list_Obj[i].position = pos;
- }
- }
- }
|