ScreenToWorld() private static method

private static ScreenToWorld ( Vector2 screen, Transform target ) : Vector3
screen Vector2
target UnityEngine.Transform
return Vector3
        private static Vector3 FindNearestPivot(Transform[] transforms, Vector2 screenPosition)
        {
            bool    flag    = false;
            Vector3 vector3 = Vector3.zero;

            foreach (Transform transform in transforms)
            {
                Vector3 world = VertexSnapping.ScreenToWorld(screenPosition, transform);
                if (!flag || (double)(vector3 - world).magnitude > (double)(transform.position - world).magnitude)
                {
                    vector3 = transform.position;
                    flag    = true;
                }
            }
            return(vector3);
        }
示例#2
0
        private static Vector3 FindNearestPivot(Transform[] transforms, Vector2 screenPosition)
        {
            bool    flag   = false;
            Vector3 vector = Vector3.zero;

            for (int i = 0; i < transforms.Length; i++)
            {
                Transform transform = transforms[i];
                Vector3   b         = VertexSnapping.ScreenToWorld(screenPosition, transform);
                if (!flag || (vector - b).magnitude > (transform.position - b).magnitude)
                {
                    vector = transform.position;
                    flag   = true;
                }
            }
            return(vector);
        }