Na FreeHostingu Endora běží desítky tisíc webů. Přidejte se ještě dnes!
Vytvořit web zdarmaNa FreeHostingu Endora běží desítky tisíc webů. Přidejte se ještě dnes!
Vytvořit web zdarmausing UnityEngine; public class CircleDraw : MonoBehaviour { public float ThetaScale = 0.01f; //Počet bodů kruhu -čím méně tím víc bodů public float radius =1f; // Poloměr public float widthLine = 0.1f; private int Size; private LineRenderer LineDrawer; private float Theta = 0f; public Material material; // Use this for initialization void Start() { LineDrawer = gameObject.AddComponent<LineRenderer>(); // Vytvoří component circleDraw(); } // Update is called once per frame void Update() { Theta = 0f; Size = (int)((1f / ThetaScale) + 1f); LineDrawer.SetVertexCount(Size); //Počet bodů kruhu - po přepočtu LineDrawer.SetWidth(0.2F, 0.2F); //Šíře čáry LineDrawer.material = material; // Materiál LineDrawer.useWorldSpace = false; // pozice objektu k objektu LineDrawer.SetWidth(widthLine,widthLine); //šíře čáry for (int i = 0; i < Size; i++) { Theta += (2.0f * Mathf.PI * ThetaScale); float x = radius * Mathf.Cos(Theta); float y = radius * Mathf.Sin(Theta); LineDrawer.SetPosition(i, new Vector3(x, y, -0.1f)); } } }