Coordinate space for Line endpoints in "Flat 2D" geometry mode?
Hi there,
I've been trying to use the Line component with a "screen-space camera" UI canvas (with canvas scaler), and have noticed some skewing of line end caps with the "Billboard" line type.
Switching to the "Flat 2D" geometry type resolves the end cap skewing, but then the endpoints are in a different place.
I tried converting the previous world-space endpoint coordinates to the canvas' local space (eg. canvas.transform.InverseTransformPoint(StartPoint)) and to screenspace coordinates (eg. RectTransformUtility.WorldToScreenPoint(canvas.worldCamera, StartPoint) ), and turning off the canvas scaler, but couldn't seem to get anything to line up properly.
I couldn't see anything in the docs about the coordinate spaces needed so thought I'd just check if there's something I'm missing?
Cheers!
thanks for the report! just found the issue with the skewing, and it has now been fixed, so it's coming in the next update!
as for getting correct coordinates, you likely want to use parent.InverseTransformPoint( worldPos ) to get the local coords you should use for the component, where parent is the parent transform of the shape
if you don't want to wait for the next release, you can make these changes in Line 2D Core.cginc