Esempio n. 1
0
        public TrackSegment(Vector3[] baseVertices, VertexPath path, Vector2Int[] edges, Mesh m)
        {
            this.baseVertices      = baseVertices;
            this.path              = path;
            this.edges             = edges;
            this.totalVertexNumber = baseVertices.Length * path.getLenght();
            this.mesh              = m;

            BuildTrackSegment();
        }
Esempio n. 2
0
        private void BuildVertices()
        {
            finalVertices = new Vector3[totalVertexNumber];

            for (int v = 0; v < path.getLenght(); v++)
            {
                Vector3   vertex = new Vector3();
                Matrix4x4 m      = GenerateRotationMatrix(path.getRotation(v));

                Debug.Log(path.getRotation(v));

                for (int z = 0; z < baseVertices.Length; z++)
                {
                    //rotate
                    vertex = m.MultiplyPoint3x4(baseVertices[z]);
                    //translate
                    vertex = vertex + path.getVertex(v);
                    //add to list
                    finalVertices[baseVertices.Length * (v) + z] = vertex;
                }
            }
        }