Skip to content

Instantly share code, notes, and snippets.

@abdullah353
Created October 16, 2014 19:21
Show Gist options
  • Select an option

  • Save abdullah353/55a553fc1836eac08c97 to your computer and use it in GitHub Desktop.

Select an option

Save abdullah353/55a553fc1836eac08c97 to your computer and use it in GitHub Desktop.
float theta_scale = 0.1; //Set lower to add more points
int size = (2.0 * PI) / theta_scale; //Total number of points in circle.
LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>();
lineRenderer.material = new Material(Shader.Find("Particles/Additive"));
lineRenderer.SetColors(c1, c2);
lineRenderer.SetWidth(0.2F, 0.2F);
lineRenderer.SetVertexCount(size);
int i = 0;
for(float theta = 0; theta < 2 * PI; theta += 0.1) {
x = r*cos(theta);
y = r*sin(theta);
Vector3 pos = new Vector3(x, y, 0);
lineRenderer.SetPosition(i, pos);
i+=1;
}
@ghadji

ghadji commented Nov 20, 2018

Copy link
Copy Markdown

4 years ago... but still life saving.. cheers buddy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment