private void Init() { if (spline == null) { spline = new CatmullRomSpline(); } origin = Vector3.zero; //transform.position; mesh = GetComponent <MeshFilter>().mesh; #if UNITY_4_0 mesh.MarkDynamic(); #endif allocatedNbQuad = advancedParameters.baseNbQuad; maxInstanciedTriCount = 0; lastStartingQuad = 0; quadOffset = 0; vertices = new Vector3[advancedParameters.baseNbQuad * NbVertexPerQuad]; triangles = new int[advancedParameters.baseNbQuad * NbTriIndexPerQuad]; uv = new Vector2[advancedParameters.baseNbQuad * NbVertexPerQuad]; uv2 = new Vector2[advancedParameters.baseNbQuad * NbVertexPerQuad]; colors = new Color[advancedParameters.baseNbQuad * NbVertexPerQuad]; normals = new Vector3[advancedParameters.baseNbQuad * NbVertexPerQuad]; Vector3 n = normal; if (n == Vector3.zero) { n = (transform.position - Camera.main.transform.position).normalized; } for (int i = 0; i < normals.Length; i++) { normals[i] = n; } //spline.knots.Clear(); spline.Clear(); List <Knot> knots = spline.knots; Vector3 point = transform.position; knots.Add(new Knot(point)); knots.Add(new Knot(point)); knots.Add(new Knot(point)); knots.Add(new Knot(point)); knots.Add(new Knot(point)); }