Пример #1
0
        protected virtual void InitPlayAreaCursor()
        {
            if (playArea == null)
            {
                Debug.LogError("No play area could be found. Have you selected a valid Boundaries SDK in the SDK Manager? If you are unsure, then click the GameObject with the `VRTK_SDKManager` script attached to it in Edit Mode and select a Boundaries SDK from the dropdown.");
                return;
            }

            Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);
            if (validLocationObject != null)
            {
                GeneratePlayAreaCursorFromPrefab(cursorDrawVertices);
            }
            else
            {
                GeneratePlayAreaCursor(cursorDrawVertices);
            }

            if (playAreaCursor != null)
            {
                playAreaCursor.SetActive(false);
                VRTK_PlayerObject.SetPlayerObject(playAreaCursor, VRTK_PlayerObject.ObjectTypes.Pointer);
                CreateCursorCollider(playAreaCursor);
                playAreaCursor.AddComponent <Rigidbody>().isKinematic = true;

                VRTK_PlayAreaCollider playAreaCursorScript = playAreaCursor.AddComponent <VRTK_PlayAreaCollider>();
                playAreaCursorScript.SetParent(this);
                playAreaCursorScript.SetIgnoreTarget(targetListPolicy);
                playAreaCursor.layer = LayerMask.NameToLayer("Ignore Raycast");
            }
        }
Пример #2
0
        protected virtual void InitPlayAreaCursor()
        {
            if (playArea == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK"));
                return;
            }

            Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);
            if (validLocationObject != null)
            {
                GeneratePlayAreaCursorFromPrefab(cursorDrawVertices);
            }
            else
            {
                GeneratePlayAreaCursor(cursorDrawVertices);
            }

            if (playAreaCursor != null)
            {
                playAreaCursor.SetActive(false);
                VRTK_PlayerObject.SetPlayerObject(playAreaCursor, VRTK_PlayerObject.ObjectTypes.Pointer);
                CreateCursorCollider(playAreaCursor);
                playAreaCursor.AddComponent <Rigidbody>().isKinematic = true;

                VRTK_PlayAreaCollider playAreaCursorScript = playAreaCursor.AddComponent <VRTK_PlayAreaCollider>();
                playAreaCursorScript.SetParent(this);
                playAreaCursorScript.SetIgnoreTarget(targetListPolicy);
                playAreaCursor.layer = LayerMask.NameToLayer("Ignore Raycast");
            }
        }
Пример #3
0
        private void InitPlayAreaCursor()
        {
            var btmRightInner = 0;
            var btmLeftInner  = 1;
            var topLeftInner  = 2;
            var topRightInner = 3;

            var btmRightOuter = 4;
            var btmLeftOuter  = 5;
            var topLeftOuter  = 6;
            var topRightOuter = 7;

            Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);

            if (playAreaCursorDimensions != Vector2.zero)
            {
                var customAreaPadding = VRTK_SDK_Bridge.GetPlayAreaBorderThickness(playArea.gameObject);

                cursorDrawVertices[btmRightOuter] = new Vector3(playAreaCursorDimensions.x / 2, 0f, (playAreaCursorDimensions.y / 2) * -1);
                cursorDrawVertices[btmLeftOuter]  = new Vector3((playAreaCursorDimensions.x / 2) * -1, 0f, (playAreaCursorDimensions.y / 2) * -1);
                cursorDrawVertices[topLeftOuter]  = new Vector3((playAreaCursorDimensions.x / 2) * -1, 0f, playAreaCursorDimensions.y / 2);
                cursorDrawVertices[topRightOuter] = new Vector3(playAreaCursorDimensions.x / 2, 0f, playAreaCursorDimensions.y / 2);

                cursorDrawVertices[btmRightInner] = cursorDrawVertices[btmRightOuter] + new Vector3(-customAreaPadding, 0f, customAreaPadding);
                cursorDrawVertices[btmLeftInner]  = cursorDrawVertices[btmLeftOuter] + new Vector3(customAreaPadding, 0f, customAreaPadding);
                cursorDrawVertices[topLeftInner]  = cursorDrawVertices[topLeftOuter] + new Vector3(customAreaPadding, 0f, -customAreaPadding);
                cursorDrawVertices[topRightInner] = cursorDrawVertices[topRightOuter] + new Vector3(-customAreaPadding, 0f, -customAreaPadding);
            }

            var width  = cursorDrawVertices[btmRightOuter].x - cursorDrawVertices[topLeftOuter].x;
            var length = cursorDrawVertices[topLeftOuter].z - cursorDrawVertices[btmRightOuter].z;
            var height = 0.01f;

            playAreaCursor = new GameObject(string.Format("[{0}]PlayAreaCursor", gameObject.name));
            playAreaCursor.transform.parent     = null;
            playAreaCursor.transform.localScale = new Vector3(width, height, length);
            playAreaCursor.SetActive(false);

            CreateCursorCollider(playAreaCursor);
            playAreaCursor.AddComponent <Rigidbody>().isKinematic = true;

            VRTK_PlayerObject.SetPlayerObject(playAreaCursor, VRTK_PlayerObject.ObjectTypes.Pointer);

            var playAreaCursorScript = playAreaCursor.AddComponent <VRTK_PlayAreaCollider>();

            playAreaCursorScript.SetParent(this);
            playAreaCursorScript.SetIgnoreTarget(targetListPolicy);
            playAreaCursor.layer = LayerMask.NameToLayer("Ignore Raycast");

            var playAreaBoundaryX = playArea.transform.localScale.x / 2;
            var playAreaBoundaryZ = playArea.transform.localScale.z / 2;
            var heightOffset      = 0f;

            DrawPlayAreaCursorBoundary(0, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmRightOuter].x, cursorDrawVertices[btmRightInner].z, cursorDrawVertices[btmRightOuter].z, height, new Vector3(0f, heightOffset, playAreaBoundaryZ));
            DrawPlayAreaCursorBoundary(1, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmLeftInner].x, cursorDrawVertices[topLeftOuter].z, cursorDrawVertices[btmLeftOuter].z, height, new Vector3(playAreaBoundaryX, heightOffset, 0f));
            DrawPlayAreaCursorBoundary(2, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmRightOuter].x, cursorDrawVertices[btmRightInner].z, cursorDrawVertices[btmRightOuter].z, height, new Vector3(0f, heightOffset, -playAreaBoundaryZ));
            DrawPlayAreaCursorBoundary(3, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmLeftInner].x, cursorDrawVertices[topLeftOuter].z, cursorDrawVertices[btmLeftOuter].z, height, new Vector3(-playAreaBoundaryX, heightOffset, 0f));
        }
Пример #4
0
        protected virtual void DrawWireframe()
        {
            if (playArea == null || roomExtender == null)
            {
                return;
            }

            var vertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);

            if (vertices == null || vertices.Length == 0)
            {
                return;
            }

            var btmRight = 4;
            var btmLeft  = 5;
            var topLeft  = 6;
            var topRight = 7;

            var btmRightVertex = vertices[btmRight] * roomExtender.additionalMovementMultiplier;
            var btmLeftVertex  = vertices[btmLeft] * roomExtender.additionalMovementMultiplier;
            var topLeftVertex  = vertices[topLeft] * roomExtender.additionalMovementMultiplier;
            var topRightVertex = vertices[topRight] * roomExtender.additionalMovementMultiplier;

            var btmOffset = new Vector3(0f, roomExtender.transform.localPosition.y, 0f);
            var topOffset = btmOffset + playArea.TransformVector(Vector3.up * wireframeHeight);

            Gizmos.color = color;
            //bottom rectangle
            Gizmos.DrawLine(btmRightVertex + btmOffset, btmLeftVertex + btmOffset);
            Gizmos.DrawLine(topLeftVertex + btmOffset, topRightVertex + btmOffset);
            Gizmos.DrawLine(btmRightVertex + btmOffset, topRightVertex + btmOffset);
            Gizmos.DrawLine(btmLeftVertex + btmOffset, topLeftVertex + btmOffset);

            //top rectangle
            Gizmos.DrawLine(btmRightVertex + topOffset, btmLeftVertex + topOffset);
            Gizmos.DrawLine(topLeftVertex + topOffset, topRightVertex + topOffset);
            Gizmos.DrawLine(btmRightVertex + topOffset, topRightVertex + topOffset);
            Gizmos.DrawLine(btmLeftVertex + topOffset, topLeftVertex + topOffset);

            //sides
            Gizmos.DrawLine(btmRightVertex + btmOffset, btmRightVertex + topOffset);
            Gizmos.DrawLine(btmLeftVertex + btmOffset, btmLeftVertex + topOffset);
            Gizmos.DrawLine(topRightVertex + btmOffset, topRightVertex + topOffset);
            Gizmos.DrawLine(topLeftVertex + btmOffset, topLeftVertex + topOffset);
        }
Пример #5
0
 // Token: 0x06001934 RID: 6452 RVA: 0x0008629C File Offset: 0x0008449C
 protected virtual void InitPlayAreaCursor()
 {
     if (this.playArea == null)
     {
         VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, new object[]
         {
             "PlayArea",
             "Boundaries SDK"
         }));
         return;
     }
     Vector3[] array = VRTK_SDK_Bridge.GetPlayAreaVertices();
     if (this.validLocationObject != null)
     {
         this.GeneratePlayAreaCursorFromPrefab(array);
     }
     else
     {
         if (array == null || array.Length < 8)
         {
             array = new Vector3[]
             {
                 new Vector3(0.8f, 0f, -0.8f),
                 new Vector3(-0.8f, 0f, -0.8f),
                 new Vector3(-0.8f, 0f, 0.8f),
                 new Vector3(0.8f, 0f, 0.8f),
                 new Vector3(1f, 0f, -1f),
                 new Vector3(-1f, 0f, -1f),
                 new Vector3(-1f, 0f, 1f),
                 new Vector3(1f, 0f, 1f)
             };
         }
         this.GeneratePlayAreaCursor(array);
     }
     if (this.playAreaCursor != null)
     {
         this.playAreaCursor.SetActive(false);
         VRTK_PlayerObject.SetPlayerObject(this.playAreaCursor, VRTK_PlayerObject.ObjectTypes.Pointer);
         this.CreateCursorCollider(this.playAreaCursor);
         this.playAreaCursor.AddComponent <Rigidbody>().isKinematic = true;
         VRTK_PlayAreaCollider vrtk_PlayAreaCollider = this.playAreaCursor.AddComponent <VRTK_PlayAreaCollider>();
         vrtk_PlayAreaCollider.SetParent(this);
         vrtk_PlayAreaCollider.SetIgnoreTarget(this.targetListPolicy);
         this.playAreaCursor.layer = LayerMask.NameToLayer("Ignore Raycast");
     }
 }
Пример #6
0
        protected virtual void GeneratePlayAreaCursor()
        {
            int btmRightInner = 0;
            int btmLeftInner  = 1;
            int topLeftInner  = 2;
            int topRightInner = 3;

            int btmRightOuter = 4;
            int btmLeftOuter  = 5;
            int topLeftOuter  = 6;
            int topRightOuter = 7;

            Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);

            if (playAreaCursorDimensions != Vector2.zero)
            {
                var customAreaPadding = VRTK_SDK_Bridge.GetPlayAreaBorderThickness(playArea.gameObject);

                cursorDrawVertices[btmRightOuter] = new Vector3(playAreaCursorDimensions.x / 2, 0f, (playAreaCursorDimensions.y / 2) * -1);
                cursorDrawVertices[btmLeftOuter]  = new Vector3((playAreaCursorDimensions.x / 2) * -1, 0f, (playAreaCursorDimensions.y / 2) * -1);
                cursorDrawVertices[topLeftOuter]  = new Vector3((playAreaCursorDimensions.x / 2) * -1, 0f, playAreaCursorDimensions.y / 2);
                cursorDrawVertices[topRightOuter] = new Vector3(playAreaCursorDimensions.x / 2, 0f, playAreaCursorDimensions.y / 2);

                cursorDrawVertices[btmRightInner] = cursorDrawVertices[btmRightOuter] + new Vector3(-customAreaPadding, 0f, customAreaPadding);
                cursorDrawVertices[btmLeftInner]  = cursorDrawVertices[btmLeftOuter] + new Vector3(customAreaPadding, 0f, customAreaPadding);
                cursorDrawVertices[topLeftInner]  = cursorDrawVertices[topLeftOuter] + new Vector3(customAreaPadding, 0f, -customAreaPadding);
                cursorDrawVertices[topRightInner] = cursorDrawVertices[topRightOuter] + new Vector3(-customAreaPadding, 0f, -customAreaPadding);
            }

            float width  = cursorDrawVertices[btmRightOuter].x - cursorDrawVertices[topLeftOuter].x;
            float length = cursorDrawVertices[topLeftOuter].z - cursorDrawVertices[btmRightOuter].z;
            float height = 0.01f;

            playAreaCursor = new GameObject(GeneratePlayAreaCursorName());
            playAreaCursor.transform.parent     = null;
            playAreaCursor.transform.localScale = new Vector3(width, height, length);

            float playAreaBoundaryX = playArea.transform.localScale.x / 2;
            float playAreaBoundaryZ = playArea.transform.localScale.z / 2;
            float heightOffset      = 0f;

            DrawPlayAreaCursorBoundary(0, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmRightOuter].x, cursorDrawVertices[btmRightInner].z, cursorDrawVertices[btmRightOuter].z, height, new Vector3(0f, heightOffset, playAreaBoundaryZ));
            DrawPlayAreaCursorBoundary(1, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmLeftInner].x, cursorDrawVertices[topLeftOuter].z, cursorDrawVertices[btmLeftOuter].z, height, new Vector3(playAreaBoundaryX, heightOffset, 0f));
            DrawPlayAreaCursorBoundary(2, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmRightOuter].x, cursorDrawVertices[btmRightInner].z, cursorDrawVertices[btmRightOuter].z, height, new Vector3(0f, heightOffset, -playAreaBoundaryZ));
            DrawPlayAreaCursorBoundary(3, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmLeftInner].x, cursorDrawVertices[topLeftOuter].z, cursorDrawVertices[btmLeftOuter].z, height, new Vector3(-playAreaBoundaryX, heightOffset, 0f));
        }
Пример #7
0
        // Token: 0x06001739 RID: 5945 RVA: 0x0007C540 File Offset: 0x0007A740
        protected virtual void DrawWireframe()
        {
            if (this.playArea == null || this.roomExtender == null)
            {
                return;
            }
            Vector3[] playAreaVertices = VRTK_SDK_Bridge.GetPlayAreaVertices();
            if (playAreaVertices == null || playAreaVertices.Length == 0)
            {
                return;
            }
            int     num    = 4;
            int     num2   = 5;
            int     num3   = 6;
            int     num4   = 7;
            Vector3 a      = playAreaVertices[num] * this.roomExtender.additionalMovementMultiplier;
            Vector3 a2     = playAreaVertices[num2] * this.roomExtender.additionalMovementMultiplier;
            Vector3 a3     = playAreaVertices[num3] * this.roomExtender.additionalMovementMultiplier;
            Vector3 a4     = playAreaVertices[num4] * this.roomExtender.additionalMovementMultiplier;
            Vector3 vector = new Vector3(0f, this.roomExtender.transform.localPosition.y, 0f);
            Vector3 b      = vector + this.playArea.TransformVector(Vector3.up * this.wireframeHeight);

            Gizmos.color = this.color;
            Gizmos.DrawLine(a + vector, a2 + vector);
            Gizmos.DrawLine(a3 + vector, a4 + vector);
            Gizmos.DrawLine(a + vector, a4 + vector);
            Gizmos.DrawLine(a2 + vector, a3 + vector);
            Gizmos.DrawLine(a + b, a2 + b);
            Gizmos.DrawLine(a3 + b, a4 + b);
            Gizmos.DrawLine(a + b, a4 + b);
            Gizmos.DrawLine(a2 + b, a3 + b);
            Gizmos.DrawLine(a + vector, a + b);
            Gizmos.DrawLine(a2 + vector, a2 + b);
            Gizmos.DrawLine(a4 + vector, a4 + b);
            Gizmos.DrawLine(a3 + vector, a3 + b);
        }
Пример #8
0
        private void InitPlayAreaCursor()
        {
            var btmRightInner = 0;
            var btmLeftInner  = 1;
            var topLeftInner  = 2;
            var topRightInner = 3;

            var btmRightOuter = 4;
            var btmLeftOuter  = 5;
            var topLeftOuter  = 6;
            var topRightOuter = 7;

            if (!playArea)
            {
                Debug.LogError("No play area could be found. Have you selected a valid Boundaries SDK in the SDK Manager? If you are unsure, then click the GameObject with the `VRTK_SDKManager` script attached to it in Edit Mode and select a Boundaries SDK from the dropdown.");
                return;
            }

            Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);

            if (playAreaCursorDimensions != Vector2.zero)
            {
                var customAreaPadding = VRTK_SDK_Bridge.GetPlayAreaBorderThickness(playArea.gameObject);

                cursorDrawVertices[btmRightOuter] = new Vector3(playAreaCursorDimensions.x / 2, 0f, (playAreaCursorDimensions.y / 2) * -1);
                cursorDrawVertices[btmLeftOuter]  = new Vector3((playAreaCursorDimensions.x / 2) * -1, 0f, (playAreaCursorDimensions.y / 2) * -1);
                cursorDrawVertices[topLeftOuter]  = new Vector3((playAreaCursorDimensions.x / 2) * -1, 0f, playAreaCursorDimensions.y / 2);
                cursorDrawVertices[topRightOuter] = new Vector3(playAreaCursorDimensions.x / 2, 0f, playAreaCursorDimensions.y / 2);

                cursorDrawVertices[btmRightInner] = cursorDrawVertices[btmRightOuter] + new Vector3(-customAreaPadding, 0f, customAreaPadding);
                cursorDrawVertices[btmLeftInner]  = cursorDrawVertices[btmLeftOuter] + new Vector3(customAreaPadding, 0f, customAreaPadding);
                cursorDrawVertices[topLeftInner]  = cursorDrawVertices[topLeftOuter] + new Vector3(customAreaPadding, 0f, -customAreaPadding);
                cursorDrawVertices[topRightInner] = cursorDrawVertices[topRightOuter] + new Vector3(-customAreaPadding, 0f, -customAreaPadding);
            }

            var width  = cursorDrawVertices[btmRightOuter].x - cursorDrawVertices[topLeftOuter].x;
            var length = cursorDrawVertices[topLeftOuter].z - cursorDrawVertices[btmRightOuter].z;
            var height = 0.01f;

            playAreaCursor = new GameObject(string.Format("[{0}]PlayAreaCursor", gameObject.name));
            playAreaCursor.transform.parent     = null;
            playAreaCursor.transform.localScale = new Vector3(width, height, length);
            playAreaCursor.SetActive(false);

            CreateCursorCollider(playAreaCursor);
            playAreaCursor.AddComponent <Rigidbody>().isKinematic = true;

            VRTK_PlayerObject.SetPlayerObject(playAreaCursor, VRTK_PlayerObject.ObjectTypes.Pointer);

            var playAreaCursorScript = playAreaCursor.AddComponent <VRTK_PlayAreaCollider>();

            playAreaCursorScript.SetParent(this);
            playAreaCursorScript.SetIgnoreTarget(targetListPolicy);
            playAreaCursor.layer = LayerMask.NameToLayer("Ignore Raycast");

            var playAreaBoundaryX = playArea.transform.localScale.x / 2;
            var playAreaBoundaryZ = playArea.transform.localScale.z / 2;
            var heightOffset      = 0f;

            DrawPlayAreaCursorBoundary(0, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmRightOuter].x, cursorDrawVertices[btmRightInner].z, cursorDrawVertices[btmRightOuter].z, height, new Vector3(0f, heightOffset, playAreaBoundaryZ));
            DrawPlayAreaCursorBoundary(1, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmLeftInner].x, cursorDrawVertices[topLeftOuter].z, cursorDrawVertices[btmLeftOuter].z, height, new Vector3(playAreaBoundaryX, heightOffset, 0f));
            DrawPlayAreaCursorBoundary(2, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmRightOuter].x, cursorDrawVertices[btmRightInner].z, cursorDrawVertices[btmRightOuter].z, height, new Vector3(0f, heightOffset, -playAreaBoundaryZ));
            DrawPlayAreaCursorBoundary(3, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmLeftInner].x, cursorDrawVertices[topLeftOuter].z, cursorDrawVertices[btmLeftOuter].z, height, new Vector3(-playAreaBoundaryX, heightOffset, 0f));
        }