Draw flat line in Unity

Hi, I have implemented a functionality that allows the user to draw lines by clicking on a terrain. I make these lines with the LineRenderer component and from a 2D view they look good but the problem comes when I change to a 3D view as lines are not flat. I need these lines to be flat and always looking upwards (as if it were a plane) and I don’t know how to do it. I saw that LineRenderer has an Aligment attribute but the options are View and TransformZ and what I need is TransformY.

2D view

3D view

Thanks!

On the LineRenderer use TransformZ and world space positioning. Then set the GameObject’s rotation to 90 degrees on the X, and it should behave how you’d like.

3 Likes

It worked!

Thanks!

1 Like