示例#1
0
    void Update()
    {
        if (!cameraTransform)
        {
            Camera camera = marManager ? marManager.GetMainCamera() : null;
            cameraTransform = camera ? camera.transform : null;
        }

        if (debugText)
        {
            string  sMessage = string.Empty;
            Vector3 pos      = Vector3.zero;
            Vector3 ori      = Vector3.zero;

            if (cameraTransform)
            {
                pos = cameraTransform.position;
                ori = cameraTransform.rotation.eulerAngles;

                sMessage += string.Format("Camera - Pos: ({0:F2}, {1:F2}, {2:F2}), Rot: ({3:F0}, {4:F0}, {5:F0})\n", pos.x, pos.y, pos.z, ori.x, ori.y, ori.z);
            }

            pos = transform.position;
            ori = transform.rotation.eulerAngles;

            sMessage += string.Format("TrPose - Pos: ({0:F2}, {1:F2}, {2:F2}), Rot: ({3:F0}, {4:F0}, {5:F0})\n", pos.x, pos.y, pos.z, ori.x, ori.y, ori.z);

            if (Input.location.status == LocationServiceStatus.Running && Input.location.lastData.timestamp != lastLocTimestamp)
            {
                LocationInfo locLast = Input.location.lastData;
                lastLocTimestamp = locLast.timestamp;

                string sLocMessage = string.Format("Lat: {0:F8}, Long: {1:F8}, Alt: {2:F8} @ {3:F3}\n", locLast.latitude, locLast.longitude, locLast.altitude, locLast.timestamp);
                sMessage += sLocMessage;

                if (locationText)
                {
                    locationText.text = sLocMessage;
                }
            }

            int pcLength = marManager ? marManager.GetPointCloudLength() : 0;
            sMessage += string.Format("PointCloud: {0} points", pcLength);

            debugText.text = sMessage;
        }
    }