1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class RtkControl : MonoBehaviour
- {
- private static RtkControl instance = null;
- private static readonly object padlock = new object();
-
- RtkControl() { }
- public static RtkControl Instance
- {
- get
- {
- lock(padlock)
- {
- if (instance == null)
- instance = new RtkControl();
- return instance;
- }
-
- }
- }
- /// <summary>
- /// 获取在当前RTK坐标内 物体应该出现在场景中的位置
- /// </summary>
- /// <param name="rtkPos"> 测量标定的RTK </param>
- /// <param name="currentRtkPos"> 当前位置的RTK </param>
- /// <param name="playPos"> 设备所在场景中的位置 </param>
- /// <param name="posY"> 返回位置的高度 </param>
- /// <returns></returns>
- public Vector3 SetRtkPos( Vector2 rtkPos , Vector2 currentRtkPos , Vector3 playPos , float posY)
- {
- Vector2 diff = rtkPos - currentRtkPos;
- Vector3 pos = new Vector3(playPos.x + diff.x, posY, playPos.z + diff.y);
- return pos;
- }
- }
|