ViewportToWorldPoint() public method

Transforms position from viewport space into world space.

public ViewportToWorldPoint ( Vector3 position ) : Vector3
position Vector3 The 3d vector in Viewport space.
return Vector3
コード例 #1
0
ファイル: Utils.cs プロジェクト: CptMedo/Mars
        public static Vector2 GetScreenSizeInWorldCoords(Camera gameCamera, float distance = 10f)
        {
            float width = 0f;
            float height = 0f;

            if (gameCamera.orthographic)
            {
                if (gameCamera.orthographicSize <= .001f)
                    return Vector2.zero;

                var p1 = gameCamera.ViewportToWorldPoint(new Vector3(0, 0, gameCamera.nearClipPlane));
                var p2 = gameCamera.ViewportToWorldPoint(new Vector3(1, 0, gameCamera.nearClipPlane));
                var p3 = gameCamera.ViewportToWorldPoint(new Vector3(1, 1, gameCamera.nearClipPlane));

                width = (p2 - p1).magnitude;
                height = (p3 - p2).magnitude;
            }
            else
            {
                height = 2.0f * distance * Mathf.Tan(gameCamera.fieldOfView * 0.5f * Mathf.Deg2Rad);
                width = height * gameCamera.aspect;
            }

            return new Vector2(width, height);
        }
コード例 #2
0
        void Set_FrameCounter_Position(FpsCounterAnchorPositions anchor_position)
        {
            switch (anchor_position)
            {
            case FpsCounterAnchorPositions.TopLeft:
                //m_TextMeshPro.anchor = AnchorPositions.TopLeft;
                m_textContainer.anchorPosition    = TextContainerAnchors.TopLeft;
                m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(0, 1, 100.0f));
                break;

            case FpsCounterAnchorPositions.BottomLeft:
                //m_TextMeshPro.anchor = AnchorPositions.BottomLeft;
                m_textContainer.anchorPosition    = TextContainerAnchors.BottomLeft;
                m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(0, 0, 100.0f));
                break;

            case FpsCounterAnchorPositions.TopRight:
                //m_TextMeshPro.anchor = AnchorPositions.TopRight;
                m_textContainer.anchorPosition    = TextContainerAnchors.TopRight;
                m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(1, 1, 100.0f));
                break;

            case FpsCounterAnchorPositions.BottomRight:
                //m_TextMeshPro.anchor = AnchorPositions.BottomRight;
                m_textContainer.anchorPosition    = TextContainerAnchors.BottomRight;
                m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(1, 0, 100.0f));
                break;
            }
        }
コード例 #3
0
        void Set_FrameCounter_Position(FpsCounterAnchorPositions anchor_position)
        {
            //Debug.Log("Changing frame counter anchor position.");
            m_TextMeshPro.margin = new Vector4(1f, 1f, 1f, 1f);

            switch (anchor_position)
            {
            case FpsCounterAnchorPositions.TopLeft:
                m_TextMeshPro.alignment           = TextAlignmentOptions.TopLeft;
                m_TextMeshPro.rectTransform.pivot = new Vector2(0, 1);
                m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(0, 1, 100.0f));
                break;

            case FpsCounterAnchorPositions.BottomLeft:
                m_TextMeshPro.alignment           = TextAlignmentOptions.BottomLeft;
                m_TextMeshPro.rectTransform.pivot = new Vector2(0, 0);
                m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(0, 0, 100.0f));
                break;

            case FpsCounterAnchorPositions.TopRight:
                m_TextMeshPro.alignment           = TextAlignmentOptions.TopRight;
                m_TextMeshPro.rectTransform.pivot = new Vector2(1, 1);
                m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(1, 1, 100.0f));
                break;

            case FpsCounterAnchorPositions.BottomRight:
                m_TextMeshPro.alignment           = TextAlignmentOptions.BottomRight;
                m_TextMeshPro.rectTransform.pivot = new Vector2(1, 0);
                m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(1, 0, 100.0f));
                break;
            }
        }
コード例 #4
0
        public static Vector2 ScreenBounds(this UnityEngine.Camera camera)
        {
            var screenBottomLeft = camera.ViewportToWorldPoint(new Vector3(0, 0, 0));
            var screenTopRight   = camera.ViewportToWorldPoint(new Vector3(1, 1, 0));

            return(new Vector2 {
                x = screenTopRight.x - screenBottomLeft.x, y = screenTopRight.y - screenBottomLeft.y
            });
        }
コード例 #5
0
        private void DrawGrid(Camera camera, Vector3 incrementSize, Color colour, bool isMajorGrid = false)
        {
            if (incrementSize.x <= 0 || incrementSize.y <= 0 || incrementSize.z <= 0)
                return;

            incrementSize *= settings.SelectedUnit.UnityUnits;

            Vector3 down = camera.cameraToWorldMatrix.MultiplyVector(new Vector3(0, -1));
            Vector3 right = camera.cameraToWorldMatrix.MultiplyVector(new Vector3(1, 0));

            Vector3 topLeft = camera.ViewportToWorldPoint(new Vector3(0, 1, 1));
            Vector3 bottomLeft = camera.ViewportToWorldPoint(new Vector3(0, 0, 1));
            Vector3 topRight = camera.ViewportToWorldPoint(new Vector3(1, 1, 1));
            Vector3 bottomRight = camera.ViewportToWorldPoint(new Vector3(1, 0, 1));

            topLeft = Snap(topLeft, incrementSize) + Mul(-down + -right, incrementSize);
            bottomLeft = Snap(bottomLeft, incrementSize) + Mul(down + -right, incrementSize);
            topRight = Snap(topRight, incrementSize) + Mul(-down + right, incrementSize);
            bottomRight = Snap(bottomRight, incrementSize) + Mul(down + right, incrementSize);

            float x = camera.orthographicSize * 2 * Screen.width / Screen.height * 1.15f;
            float y = camera.orthographicSize * 2;

            float xIncrement = LargestComponent(Mask(incrementSize, right));
            float yIncrement = LargestComponent(Mask(incrementSize, down));

            int xCount = (int)(Mathf.Ceil(x / xIncrement));
            int yCount = (int)(Mathf.Ceil(y / yIncrement));

            Handles.color = colour;

            for (int i = 0; i <= xCount; i++)
            {
                Vector3 a = topLeft + i * Mul(incrementSize, right);
                Vector3 b = bottomLeft + i * Mul(incrementSize, right);

                Handles.DrawLine(a, b);
            }

            for (int j = 0; j <= yCount; j++)
            {
                Vector3 a = topLeft + j * Mul(down, incrementSize);
                Vector3 b = topRight + j * Mul(down, incrementSize);

                Handles.DrawLine(a, b);
            }

            if (settings.DrawAxes)
            {
                Handles.color = Color.red;
                Handles.DrawLine(new Vector3(topLeft.x, 0, 0), new Vector3(topRight.x, 0, 0));
                Handles.color = Color.green;
                Handles.DrawLine(new Vector3(0, topLeft.y, 0), new Vector3(0, bottomLeft.y, 0));
                Handles.color = Color.blue;
                Handles.DrawLine(new Vector3(0, 0, topLeft.z), new Vector3(0, 0, bottomRight.z));
            }
        }
コード例 #6
0
ファイル: VLSViewer.cs プロジェクト: tmkebr/Untitled
        public static Rect GetCameraBounds(Camera _camera, float _tolerance = 5)
        {
            Rect _rct = new Rect(0, 0, 0, 0);

            Vector3 upperLeft = _camera.ViewportToWorldPoint(new Vector3(0, 0, _camera.farClipPlane));
            Vector3 lowerRight = _camera.ViewportToWorldPoint(new Vector3(1, 1, _camera.farClipPlane));
            _rct.Set(upperLeft.x - _tolerance, upperLeft.y - _tolerance, lowerRight.x - upperLeft.x + _tolerance * 2, lowerRight.y - upperLeft.y + _tolerance * 2);

            return _rct;
        }
コード例 #7
0
ファイル: CameraEditor.cs プロジェクト: willstall/FPS_0
        static void DrawCameraFrustrum( Camera camera , bool isSelected)
        {
            Handles.color = (isSelected == true) ? ( Color.grey ) : ( Color.white );

            float z =  camera.nearClipPlane;
            Vector3 v1a = camera.ViewportToWorldPoint(new Vector3(0f, 0f, z));
            Vector3 v2a = camera.ViewportToWorldPoint(new Vector3(0f, 1f, z));
            Vector3 v3a = camera.ViewportToWorldPoint(new Vector3(1f, 1f, z));
            Vector3 v4a = camera.ViewportToWorldPoint(new Vector3(1f, 0f, z));

            z = camera.farClipPlane;
            Vector3 v1b = camera.ViewportToWorldPoint(new Vector3(0f, 0f, z));
            Vector3 v2b = camera.ViewportToWorldPoint(new Vector3(0f, 1f, z));
            Vector3 v3b = camera.ViewportToWorldPoint(new Vector3(1f, 1f, z));
            Vector3 v4b = camera.ViewportToWorldPoint(new Vector3(1f, 0f, z));

            Handles.DrawLine(v1a, v1b);
            Handles.DrawLine(v2a, v2b);
            Handles.DrawLine(v3a, v3b);
            Handles.DrawLine(v4a, v4b);

            Handles.DrawLine(v1a, v2a);
            Handles.DrawLine(v1a, v4a);
            Handles.DrawLine(v3a, v2a);
            Handles.DrawLine(v3a, v4a);

            Handles.DrawLine(v1b, v2b);
            Handles.DrawLine(v1b, v4b);
            Handles.DrawLine(v3b, v2b);
            Handles.DrawLine(v3b, v4b);
        }
コード例 #8
0
		/// <summary>
		/// 	Gets the corners.
		/// </summary>
		/// <param name="camera">Camera.</param>
		/// <param name="distance">Distance.</param>
		/// <param name="corners">Corners.</param>
		public static void GetCorners(Camera camera, float distance, ref Vector3[] corners)
		{
			Array.Resize(ref corners, 4);

			// Top left
			corners[0] = camera.ViewportToWorldPoint(new Vector3(0, 1, distance));

			// Top right
			corners[1] = camera.ViewportToWorldPoint(new Vector3(1, 1, distance));

			// Bottom left
			corners[2] = camera.ViewportToWorldPoint(new Vector3(0, 0, distance));

			// Bottom right
			corners[3] = camera.ViewportToWorldPoint(new Vector3(1, 0, distance));
		}
コード例 #9
0
        /// <summary>
        /// Gets the camera right border in world position
        /// </summary>
        /// <returns>The left border.</returns>
        /// <param name="camera">Camera.</param>
        public static float GetRightBorder(UnityEngine.Camera camera = null)
        {
            camera = camera ?? UnityEngine.Camera.main;

            var dist = (Vector3.zero - camera.transform.position).z;

            return(camera.ViewportToWorldPoint(new Vector3(1, 0, dist)).x);
        }
コード例 #10
0
        void Start ()
        {
            camera = GetComponent<Camera> ();
            vertExtent = camera.orthographicSize;
            horzExtent = vertExtent * Screen.width / Screen.height;
            deltaCenterVec = camera.ViewportToWorldPoint (new Vector3 (0.5f, 0.5f, 0))
                - camera.ViewportToWorldPoint (new Vector3 (cameraCenterX, cameraCenterY, 0));


            isFollowHorizontal = (followType & Direction.Horizontal) == Direction.Horizontal;
            isFollowVertical = (followType & Direction.Vertical) == Direction.Vertical;
            isBoundHorizontal = (boundType & Direction.Horizontal) == Direction.Horizontal;
            isBoundVertical = (boundType & Direction.Vertical) == Direction.Vertical;

            isDeadZoneHorizontal = ((deadZoneType & Direction.Horizontal) == Direction.Horizontal) && isFollowHorizontal;
            isDeadZoneVertical = ((deadZoneType & Direction.Vertical) == Direction.Vertical) && isFollowVertical;
            tempVec = Vector3.one;
        }
コード例 #11
0
ファイル: Cloud.cs プロジェクト: SeiChuu/PixelGame-Public
        private void Awake()
        {
            MainCamera = UnityEngine.Camera.main;
            if (MainCamera != null)
            {
                var pos = MainCamera.ViewportToWorldPoint(new Vector3(Random.Range(-1, 0), Random.Range(0, 1f)));
                transform.position = new Vector3(pos.x, pos.y, 0);
            }

            transform.localScale = new Vector3(4, 4, 0);
            GetComponentInChildren <SpriteRenderer>().sortingOrder = -100;
        }
コード例 #12
0
        // Update is called once per frame
        void Update()
        {
            if (target)
            {
                Vector3 point       = myCamera.WorldToViewportPoint(target.position);
                Vector3 delta       = target.position - myCamera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 10)); //(new Vector3(0.5, 0.5, point.z));
                Vector3 destination = transform.position + delta;
                destination.y = 4;

                transform.position = Vector3.SmoothDamp(transform.position, destination, ref velocity, dampTime);
            }
        }
コード例 #13
0
        /// <summary>
        /// Gets the 3D world position.
        /// </summary>
        /// <returns>The 3D world position.</returns>
        /// <param name="ui">NGUI.</param>
        /// <param name="cam">Cam.</param>
        public static Vector3 GetViewportToWorldPoint(GameObject ui, Camera cam, Camera guiCam = null)
        {
            if (guiCam == null) {
                guiCam = SceneManager.Instance.NGUICamera;
                if (guiCam == null) {
                    return Vector3.zero;
                }
            }

            Vector3 position = cam.ViewportToWorldPoint (guiCam.WorldToViewportPoint (ui.transform.position));
            position.z = 0;

            return position;
        }
コード例 #14
0
 static public int ViewportToWorldPoint(IntPtr l)
 {
     try{
         UnityEngine.Camera  self = (UnityEngine.Camera)checkSelf(l);
         UnityEngine.Vector3 a1;
         checkType(l, 2, out a1);
         UnityEngine.Vector3 ret = self.ViewportToWorldPoint(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #15
0
 static public int ViewportToWorldPoint(IntPtr l)
 {
     try {
         UnityEngine.Camera  self = (UnityEngine.Camera)checkSelf(l);
         UnityEngine.Vector3 a1;
         checkType(l, 2, out a1);
         var ret = self.ViewportToWorldPoint(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #16
0
        internal LatLongAltitude ViewportToGeographicPoint(Vector3 viewportSpacePosition, UnityEngine.Camera camera)
        {
            var unityWorldSpacePosition = camera.ViewportToWorldPoint(viewportSpacePosition);

            if (m_coordinateSystem == CoordinateSystem.UnityWorld)
            {
                return(m_frame.LocalSpaceToLatLongAltitude(unityWorldSpacePosition));
            }
            else
            {
                var finalPositionECEF = m_originECEF + unityWorldSpacePosition;

                return(LatLongAltitude.FromECEF(finalPositionECEF));
            }
        }
コード例 #17
0
 private static bool GetFrustum(Camera camera, Vector3[] near, Vector3[] far, out float frustumAspect)
 {
     frustumAspect = GetFrustumAspectRatio(camera);
     if (frustumAspect < 0f)
     {
         return false;
     }
     if (far != null)
     {
         far[0] = new Vector3(0f, 0f, camera.farClipPlane);
         far[1] = new Vector3(0f, 1f, camera.farClipPlane);
         far[2] = new Vector3(1f, 1f, camera.farClipPlane);
         far[3] = new Vector3(1f, 0f, camera.farClipPlane);
         for (int i = 0; i < 4; i++)
         {
             far[i] = camera.ViewportToWorldPoint(far[i]);
         }
     }
     if (near != null)
     {
         near[0] = new Vector3(0f, 0f, camera.nearClipPlane);
         near[1] = new Vector3(0f, 1f, camera.nearClipPlane);
         near[2] = new Vector3(1f, 1f, camera.nearClipPlane);
         near[3] = new Vector3(1f, 0f, camera.nearClipPlane);
         for (int j = 0; j < 4; j++)
         {
             near[j] = camera.ViewportToWorldPoint(near[j]);
         }
     }
     return true;
 }
コード例 #18
0
    public static void TickBullets(World model)
    {
        foreach (var bullet in model.bullets.Values)
        {
            bullet.dir += model.wind;
            bullet.pos += bullet.dir * bullet.speed;

            UnityEngine.Camera  cam = UnityEngine.Camera.main;
            UnityEngine.Vector2 bulletViewportPos = cam.WorldToViewportPoint(bullet.pos.Vector3());
            UnityEngine.Vector3 bulletWorldPos    = bullet.pos.Vector3();

            if (bulletViewportPos.x < 0 || bulletViewportPos.x > 1)
            {
                bullet.dir = new Position(-bullet.dir.x, bullet.dir.y).Normalize();
                bullet.pos = new Position(
                    cam.ViewportToWorldPoint(
                        new UnityEngine.Vector2(UnityEngine.Mathf.Clamp01(bulletViewportPos.x), bulletViewportPos.y)
                        )
                    );
                bullet.ricochetLifeHits--;

                AudioController.Instance.PlaySound(AudioController.Sound.Ricoshet);
            }
            if (bulletViewportPos.y < 0 || bulletViewportPos.y > 1)
            {
                bullet.dir = new Position(bullet.dir.x, -bullet.dir.y).Normalize();
                bullet.pos = new Position(
                    cam.ViewportToWorldPoint(
                        new UnityEngine.Vector2(bulletViewportPos.x, UnityEngine.Mathf.Clamp01(bulletViewportPos.y))
                        )
                    );
                bullet.ricochetLifeHits--;
                AudioController.Instance.PlaySound(AudioController.Sound.Ricoshet);
            }

            foreach (var bandit in model.bandits.Values)
            {
                Circle bulletCircle = CollisionService.CreateCircle(bullet.pos, bullet.dir * bullet.radius, bullet.radius);
                Circle banditCircle = CollisionService.CreateCircle(bandit.pos, new Position(), bandit.radius);

                Position hitPoint;
                if (CollisionService.DynamicToStaticCircleCollision(bulletCircle, banditCircle, out hitPoint))
                {
                    model.gizmos.Add(hitPoint);

                    Position delta  = hitPoint - bandit.pos;
                    Position normal = delta.Normalize();

                    Position pushDir = (bullet.dir * 0.5f + normal * 0.75f).Normalize();


                    bullet.pos = hitPoint;
                    bullet.dir = pushDir;
                    bullet.ricochetLifeHits--;
                    bullet.hits++;

                    bandit.pos += pushDir * -2f;
                    bandit.hp--;

                    if (bandit.hp <= 0)
                    {
                        bandit.isActive = false;
                    }
                    else if (bandit.hp > 0)
                    {
                        model.events.Enqueue(new BanditDamagedEvent(bandit.id));
                    }
                }
            }

            if (bullet.ricochetLifeHits <= 0)
            {
                bullet.isActive = false;
            }
        }
    }
コード例 #19
0
 private static bool GetFrustum(Camera camera, Vector3[] near, Vector3[] far, out float frustumAspect)
 {
   frustumAspect = CameraEditor.GetFrustumAspectRatio(camera);
   if ((double) frustumAspect < 0.0)
     return false;
   if (far != null)
   {
     far[0] = new Vector3(0.0f, 0.0f, camera.farClipPlane);
     far[1] = new Vector3(0.0f, 1f, camera.farClipPlane);
     far[2] = new Vector3(1f, 1f, camera.farClipPlane);
     far[3] = new Vector3(1f, 0.0f, camera.farClipPlane);
     for (int index = 0; index < 4; ++index)
       far[index] = camera.ViewportToWorldPoint(far[index]);
   }
   if (near != null)
   {
     near[0] = new Vector3(0.0f, 0.0f, camera.nearClipPlane);
     near[1] = new Vector3(0.0f, 1f, camera.nearClipPlane);
     near[2] = new Vector3(1f, 1f, camera.nearClipPlane);
     near[3] = new Vector3(1f, 0.0f, camera.nearClipPlane);
     for (int index = 0; index < 4; ++index)
       near[index] = camera.ViewportToWorldPoint(near[index]);
   }
   return true;
 }
コード例 #20
0
        // Use this for initialization
        void Start()
        {
            //initialize the player character
            Vector3 charPos = new Vector3(25.5f, -1.8f, 2.0f);
            characters.Add((GameObject)Instantiate(Character, charPos, Quaternion.identity));

            //set camera to follow the Camera Target
            Vector3 camPos = new Vector3(25.5f, -1.8f, 0.0f);
            cameraTargets.Add((GameObject)Instantiate(CamTarget, camPos, Quaternion.identity));

            Transform targetTransform = cameraTargets[0].transform;
            mainCam = Camera.allCameras[0];
            mainCam.GetComponent<SmoothFollow>().target = targetTransform;

            //Find the light
            light = GameObject.Find("Directional Light");

            //initialize the front wall
            Vector3 wallPos = mainCam.ViewportToWorldPoint(new Vector3(1.0f, 0.0f, 0.0f));
            wallPos.z = 2.0f; // resets to platform Z
            wallPos.y = -3.0f; // brings wall to ground
            wallPos.x *= 1.6f; // moves wall half of screen width away from camera
            frontWalls.Add((GameObject)Instantiate(FrontWall, wallPos, Quaternion.identity));
            frontWalls[0].transform.Rotate(0.0f, 0.0f, 90.0f);

            //initialize the kill zone
            Vector3 killZonePos = mainCam.ScreenToViewportPoint(new Vector3(0.0f, 0.0f, 2.0f));
            killZonePos.x += 7.0f; // move slightly right from current lock location
            KillZones.Add((GameObject)Instantiate(KillZone, killZonePos, Quaternion.identity));
            killZones[0].transform.Rotate(0.0f, 0.0f, 90.0f);

            // create bottom killzone
            Vector3 underworld = new Vector3(0.0f, -11.5f, 2.0f);
            killZones.Add((GameObject)Instantiate(KillZone, underworld, Quaternion.identity));

            // create knife
            knifeSpawn = new Vector3(killZonePos.x, killZonePos.y, killZonePos.z);
            knifeSpawn.x += 2.0f; // move slightly right from current lock location
            knife = (GameObject)Instantiate(Knife, knifeSpawn, Quaternion.identity);
            knife.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);
            thrown = false;

            // create chef
            chefSpawn = new Vector3(killZonePos.x, killZonePos.y, killZonePos.z);
            chefSpawn.x += 2.0f; // move slightly right from current lock location
            Chef = (GameObject)Instantiate(Chef, chefSpawn, Quaternion.identity);
            chefOnScreen = false;
            chefMovingOut = false;

            mainCam.aspect = (1920f / 910f);

            //initialize the game fragments
            for (int i = 0; i < numFrags; i++)
            {
                Vector3 fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                //make the first two fragments flat
                if (i == 0 || i == 1) fragments.Add((GameObject)Instantiate(GameFragments[0], fragPos, Quaternion.identity));
                else
                {
                    float fragType = Random.Range(0.0f, (float)GameFragments.Count);
                    if (fragType >= 0 && fragType < 1)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[0], fragPos, Quaternion.identity));
                    }
                    else if (fragType >= 1 && fragType < 2)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[1], fragPos, Quaternion.identity));
                    }
                    else if (fragType >= 2 && fragType < 3)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[2], fragPos, Quaternion.identity));
                    }
                    else if (fragType >= 3 && fragType < 4)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[3], fragPos, Quaternion.identity));
                    }
                    else if (fragType >= 4 && fragType < 5)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[4], fragPos, Quaternion.identity));
                    }
                    else if (fragType >= 5 && fragType < 6)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[5], fragPos, Quaternion.identity));
                    }
                    else if (fragType >= 6 && fragType < 7)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[6], fragPos, Quaternion.identity));
                    }
                    else if (fragType >= 7 && fragType < 8)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[7], fragPos, Quaternion.identity));
                    }
                    else if (fragType >= 8 && fragType < 9)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[8], fragPos, Quaternion.identity));
                    }
                    else if (fragType >= 9 && fragType <= 10)
                    {
                        fragPos = new Vector3(i * 25.0f, -3.5f, 2.0f);
                        fragments.Add((GameObject)Instantiate(GameFragments[9], fragPos, Quaternion.identity));
                    }
                }
            }
        }