# How to draw an arc between two angles?

I'd like to draw an arc between two specific angles. For example, "draw an angle between 0 and 90 degrees" and it will draw only that part of the circle and ignore the rest.

You can define an arc with a radius and start and end angle. Then you simply need to create a series of points to define the arc.

List<Vector2> arcPoints = new List<Vector2>();
float angle = startAngle;
float arcLength = endAngle - startAngle;
for (int i = 0; i <= segments; i++)
{

angle += (arcLength / segments);
}


This example creates a list of points that define an arc. The arc can be made "smoother" by increasing the number of segments.

Drawing the arc is your choice, you can create a mesh, use the LineRenderer or something like GL.LINES.

• Thanks for the answer. Will this algorithme achieve something like this : bit.ly/2aZBvwk Or I will get a pizza-like shape ? (for reference I want to do something like the image) – PL Audet Aug 17 '16 at 17:42
• This algorithm simply defines the points that make up the arc. It's up to you to decide how to render them. The LineRenderer would probably be the easiest option for what you want. Just set the LineRenderer's points to the ones generated in the algorithm above. – MichaelHouse Aug 17 '16 at 17:44
• Thansk for your help. – PL Audet Aug 17 '16 at 17:46
• Mind if i ask another question ? :What I want to to draw these line relatively to my transform ? – PL Audet Aug 17 '16 at 23:51
• Add the position of the transform to each of the arc points. – MichaelHouse Aug 18 '16 at 1:35