HoloLens定位

1.1使用第三方AR识别SDK--Vuforia

Hololens与ARcore结合实现第三视角(三)

设置识别图的长宽和你要扫描识别的图的尺寸一致!

设置识别图的长宽和你要扫描识别的图的尺寸一致!

设置识别图的长宽和你要扫描识别的图的尺寸一致!

Hololens与ARcore结合实现第三视角(三)

Hololens与ARcore结合实现第三视角(三)

1.2发送定位数据:

 public void StartScan()
    {
        print("StartScan...");
    }
    public void StopScan()
    {
        IsScanning = false;
        Vuforia.enabled = false;
        ArImageTarget.SetActive(false);
    }
    public void OnFindTarget(string targetName)
    {
        if (!IsScanning) return;

        if (targetName=="Minecraft")
        {
            ShowMessageManager.Instance.ShowTextMessage("识别定位成功!",3);
            Vuforia.enabled = false;
            ArImageTarget.SetActive(false);
            IsScanning = false;

            CmdSendArCoreLocation();
        }
    }
    public void CmdSendArCoreLocation()  //发送给ARCore位置信息
    {
        string method = "SendArCoreLocation";
        GameObject go = new GameObject();
        go.transform.rotation = ArImageTarget.transform.rotation;
        go.transform.position = ArImageTarget.transform.position;

        Root.SetParent(go.transform);

        Vector3 pos = Root.transform.localPosition;
        Vector3 rot = Root.transform.localEulerAngles;

        object[] parameters = new object[] {
            pos.x, pos.y,pos.z,
            rot.x,rot.y,rot.z
        }; 
        MessageSendManager.Instance.SendRoomOrderAll(method, parameters);
    }

Hololens与ARcore结合实现第三视角(四)

相关文章:

  • 2021-09-06
  • 2021-07-03
  • 2022-03-07
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-11-20
  • 2021-11-18
猜你喜欢
  • 2021-04-19
  • 2021-09-21
  • 2021-04-13
  • 2021-10-20
  • 2021-06-16
相关资源
相似解决方案