public void CalcVerts() { h.GPUHeightGetter(Position + transform.position, scale); vert = new Vector3[tri.Length]; colors = new Color[tri.Length]; uv = new Vector2[tri.Length]; for (int tt = 0; tt < tri.Length; tt++) { vert[tt] = h.h[tri[tt]]; uv[tt] = (new Vector2(vert[tt].x * scale + transform.position.x, vert[tt].z * scale + transform.position.z)) / 200f; } mymesh.SetVertices(vert); mymesh.SetUVs(0, uv); transform.localScale = new Vector3(scale, 1, scale); m.sharedMesh = mymesh; m.sharedMesh.RecalculateBounds(); m.sharedMesh.RecalculateNormals(); m.sharedMesh.GetNormals(norm); for (int tt = 0; tt < vert.Length; tt++) { float e = vert[tt].y / 1500f + .035f; // float nn = (Vector3.up - norm[tt]).magnitude *.5f; // e = e*.95f + nn*.05f; colors[tt] = grade.Evaluate(e); } m.sharedMesh.SetColors(colors); coll.sharedMesh = m.sharedMesh; }