/// <summary>
/// Convert the specified world point from one camera's world space to another, then make it relative to the specified transform.
/// You should use this function if you want to position a widget using some 3D point in space.
/// Pass your main camera for the "worldCam", and your UI camera for "uiCam", then the widget's transform for "relativeTo".
/// You can then assign the widget's localPosition to the returned value.
/// </summary>
static public Vector3 WorldToLocalPoint (Vector3 worldPos, Camera worldCam, Camera uiCam, Transform relativeTo)
{
worldPos = worldCam.WorldToViewportPoint(worldPos);
worldPos = uiCam.ViewportToWorldPoint(worldPos);
if (relativeTo == null) return worldPos;
relativeTo = relativeTo.parent;
if (relativeTo == null) return worldPos;
return relativeTo.InverseTransformPoint(worldPos);
}