Skip to content

Instantly share code, notes, and snippets.

@smkplus
Created August 20, 2018 06:03
Show Gist options
  • Save smkplus/51f09bb2ca34c9871896dd20a54fc0a1 to your computer and use it in GitHub Desktop.
Save smkplus/51f09bb2ca34c9871896dd20a54fc0a1 to your computer and use it in GitHub Desktop.
private void OnDrawGizmos() {
Gizmos.color = Color.yellow;
float theta = 0;
float Radius = transform.localScale.magnitude;
float x = Radius*Mathf.Cos(theta);
float y = Radius*Mathf.Sin(theta);
Vector3 pos = transform.position+new Vector3(x,0,y);
Vector3 newPos = pos;
Vector3 lastPos = pos;
for(theta = 0.1f;theta<Mathf.PI*2;theta+=0.1f){
x = Radius*Mathf.Cos(theta);
y = Radius*Mathf.Sin(theta);
newPos = transform.position+ new Vector3(x,0,y);
Gizmos.DrawLine(pos,newPos);
pos = newPos;
}
Gizmos.DrawLine(pos,lastPos);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment