unityd 模型跟随鼠标移动,鼠标隐藏

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Input.mousePosition.x < 400 && Input.mousePosition.y > 300)
            UnityEngine.Screen.showCursor = true;
        else
        {
            UnityEngine.Screen.showCursor = false;
            if (Physics.Raycast(ray, out hit, 100))
            {
                cursor.transform.position = new Vector3(hit.point.x, 1, hit.point.z);
            }
        }

你可能感兴趣的:(鼠标,unity3d)