Skip to content

Commit

Permalink
#16
Browse files Browse the repository at this point in the history
  • Loading branch information
MephestoKhaan committed Jun 3, 2020
1 parent 13f2d55 commit fe0baec
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Assets/EventVisualizer/Editor/EventsGraphWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ private static Vector2 WorldToGUIPoint(Vector3 p, Vector3 p2, out bool behindScr

if (behindScreen) {
if (p2 == cam.transform.position) return Vector2.zero;

var Plane = new Plane(cam.transform.forward, cam.transform.position + cam.transform.forward * cam.nearClipPlane);
Ray r = new Ray(p, p2 - p);
float enter;
Expand All @@ -451,9 +451,10 @@ private static Vector2 WorldToGUIPoint(Vector3 p, Vector3 p2, out bool behindScr

viewPos = cam.WorldToViewportPoint(proj);
}

Vector2 viewScreenVector = new Vector2(viewPos.x, viewPos.y);
return new Vector2(viewScreenVector.x * cam.pixelWidth, (1 - viewScreenVector.y) * cam.pixelHeight);
float scaleFactor = 1f;
return new Vector2(
viewPos.x * cam.scaledPixelWidth,
(1 - viewPos.y) * cam.scaledPixelHeight) * scaleFactor;
}
}
}

0 comments on commit fe0baec

Please sign in to comment.