Esempio n. 1
0
        void Rebuild()
        {
            // Create a circle of points with randomized distance from origin.
            Vector3[] points = new Vector3[32];

            for (int i = 0, c = points.Length; i < c; i++)
            {
                float angle = Mathf.Deg2Rad * ((i / (float)c) * 360f);
                points[i] = new Vector3(Mathf.Cos(angle), 0f, Mathf.Sin(angle)) * Random.Range(m_RadiusMin, m_RadiusMax);
            }

            // CreateShapeFromPolygon is an extension method that sets the pb_Object mesh data with vertices and faces
            // generated from a polygon path.
            m_Mesh.CreateShapeFromPolygon(points, m_Height, m_FlipNormals);
        }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        var go = new GameObject();

        objetoPrueba = go.gameObject.AddComponent <pb_Object>();

        //InvokeRepeating("Rebuild", 0f, .1f);
        Vector3[] points = new Vector3[5];

        for (int i = 0, c = points.Length; i < c; i++)
        {
            float angle = Mathf.Deg2Rad * ((i / (float)c) * 360f);
            points[i] = new Vector3(Mathf.Cos(angle), 0f, Mathf.Sin(angle)) * Random.Range(m_RadiusMin, m_RadiusMax);
        }

        // CreateShapeFromPolygon is an extension method that sets the pb_Object mesh data with vertices and faces
        // generated from a polygon path.
        objetoPrueba.CreateShapeFromPolygon(points, m_Height, m_FlipNormals);
    }