コード例 #1
0
        /**
         *	\brief This is responsible for moving the camera around and not much else.
         */
        public void LateUpdate()
        {
            if (!currentSelection.HasObject())
            {
                return;
            }

            if (Input.GetMouseButtonDown(1) || (Input.GetMouseButtonDown(0) && Input.GetKey(KeyCode.LeftAlt)))
            {
                mousePosition_initial = Input.mousePosition;
                dragging = true;
            }

            if (dragging)
            {
                Vector2 delta = (Vector3)mousePosition_initial - (Vector3)Input.mousePosition;
                Vector3 dir   = new Vector3(delta.y, delta.x, 0f);

                currentSelection.pb.gameObject.transform.RotateAround(Vector3.zero, dir, rotateSpeed * Time.deltaTime);

                // If there is a currently selected face, update the preview.
                if (currentSelection.IsValid())
                {
                    RefreshSelectedFacePreview();
                }
            }

            if (Input.GetMouseButtonUp(1) || Input.GetMouseButtonUp(0))
            {
                dragging = false;
            }
        }
コード例 #2
0
 public void LateUpdate()
 {
     if (!currentSelection.HasObject())
     {
         return;
     }
     if (Input.GetMouseButtonDown(1) || (Input.GetMouseButtonDown(0) && Input.GetKey(KeyCode.LeftAlt)))
     {
         mousePosition_initial = Input.mousePosition;
         dragging = true;
     }
     if (dragging)
     {
         Vector2 vector = (Vector3)mousePosition_initial - Input.mousePosition;
         Vector3 axis   = new Vector3(vector.y, vector.x, 0f);
         currentSelection.pb.gameObject.transform.RotateAround(Vector3.zero, axis, rotateSpeed * Time.deltaTime);
         if (currentSelection.IsValid())
         {
             RefreshSelectedFacePreview();
         }
     }
     if (Input.GetMouseButtonUp(1) || Input.GetMouseButtonUp(0))
     {
         dragging = false;
     }
 }