Exemple #1
0
        void Update()
        {
            var overlay = OpenVR.Overlay;

            if (overlay == null)
            {
                return;
            }

            if (handle == OpenVR.k_ulOverlayHandleInvalid)
            {
                Utils.CreateOverlay(key, gameObject.name, ref handle);
            }

            var o = new Utils.OverlayHelper(handle);

            if (texture != null && o.Valid)
            {
                o.Show();

                o.SetColorWithAlpha(TransformColor(color));
                o.SetWidthInMeters(width);

                o.SetInputMethod(VROverlayInputMethod.None);
                o.SetMouseScale(1, 1);

                var offset = new SteamVR_Utils.RigidTransform(transform);
                if (!Utils.IsFacingHmd(transform))
                {
                    offset.rot = offset.rot * Quaternion.AngleAxis(180, Vector3.up);
                }
                o.SetFullTexture(texture);
                o.SetTransformAbsolute(ETrackingUniverseOrigin.TrackingUniverseStanding, offset);
            }
        }
Exemple #2
0
        void Update()
        {
            var overlay = OpenVR.Overlay;

            if (overlay == null)
            {
                return;
            }

            if (handle == OpenVR.k_ulOverlayHandleInvalid)
            {
                Init();
            }

            if (texture != null && handle != OpenVR.k_ulOverlayHandleInvalid)
            {
                var o = new Utils.OverlayHelper(handle);
                o.Show();

                if (texture != lastTexture)
                {
                    o.SetFullTexture(texture);
                    lastTexture = texture;
                }
                o.SetColorWithAlpha(Color.white);
                o.SetWidthInMeters(.05f);

                o.SetInputMethod(VROverlayInputMethod.None);
                o.SetMouseScale(1, 1);

                var offset = new SteamVR_Utils.RigidTransform(transform);
                if (!Utils.IsFacingHmd(transform))
                {
                    offset.rot = offset.rot * Quaternion.AngleAxis(180, Vector3.up);
                }

                o.SetTransformAbsolute(ETrackingUniverseOrigin.TrackingUniverseStanding, offset);
            }
        }