Lines Between Screen and World Space

A line generated between a UI transform (screen space) and a game object in world space.

I am back working on my golem concept but in a new direction. I really like the spherical world mechanic and have been playing around with the procedural generation on a mini planet that the player navigates. More on that to come on that and some cool stuff that I have done with the shader graph.

// targeting
public RectTransform screenPoint;
public Transform targetObject;

private void FixedUpdate() {
   DrawLine(screenPoint.position, targetObject.position);
}

private void DrawLine(Vector3 toPoint, Vector3 fromPoint) {
   Debug.DrawLine(toPoint, fromPoint, Color.white);
}

I am getting some jittering on the screen point as the player moves around. I need to investigate why this is happening. I have my suspicions that I need to convert the vector into an actual screen space vector.

My next option is to look into Unity’s Line Render. Well see how that turns out.