- Home /
Draw a round-shaped line
Hi folks,
I'm making a simple game in Unity where the main gameplay is as simple as connecting certain points by drawing straight lines between each of them. I'm a newbie in Unity, but I'm fairly experienced in Action script 3. I've looked for ways to draw lines between points, which is extremely simple in AS3, but it seems way more complicated in Unity. Thus far I've chosen to use LineRenderer to draw multiple lines from one point to another. The line between the first two points looks perfect, but the problem is that when the second line is being drawn, the first one bends out of shape. Now, I'm perfectly aware why that happens: By default, the lines are flat and that's why they bend when the following line is "rerouted" in another direction. In order to prevent this unwanted bending effect, I think I'm going to need a rounded line. The problem is I don't have a clue how to do that. I'm accepting any solution including or excluding LineRenderer, as far as it resolves my problem for a nice and smooth way to draw lines between points.
Thanks.
Lines can't be round they are a connection between two vertices.
Answer by Screenhog · Aug 13, 2012 at 05:02 PM
Could you show a screenshot or two of what's happening? I'm having difficulty visualizing this, especially since my experience with LineRenderer has resulted in nothing but straight lines.
I'd also recommend checking the Unity Asset Store. There's a fairly highly-rated product called Vectrosity that might be exactly what you need.
Answer by DESTRUKTORR · Aug 13, 2012 at 05:05 PM
I believe what he means is he wants it to create a curve. What I'm assuming he's saying is happening is that it is creating a sharp angle (or "corner"), generating a single angle from the first point to the second to the third, whereas he wants it to smooth out into a curve shape.
I wouldn't know the exact implications of increasing the vertex count (dynamically) to make it a semi-smooth curve, but I wouldn't suggest trying it. It sounds like it would just lock up, even with only three points.
I would suggest you look at this tutorial.
Answer by Krshojestic · Aug 13, 2012 at 06:22 PM
Thank you for the response, this was my problem actually: http://answers.unity3d.com/questions/64716/can-i-render-nice-thick-lines-with-linerenderer-wi.html
This topic can be deleted.
Your answer
Follow this Question
Related Questions
Draw a line with collision 2 Answers
Draw line in runtime 1 Answer
How should I do to draw lines like this? 0 Answers
How do I draw lines in a Rect 1 Answer
Drawing lines from mouse position 2 Answers