// Update is called once per frame void Update() { offset += deltaOffset; int count = 0; for (int i = 0; i < heightCount; ++i) { for (int j = 0; j < widthCount; ++j) { vertices[count].y = waterVolume.getHeight(j, i); uv[count] += returnRandom.GetNextRandom(uv[count].x - i, uv[count].y - j); ++count; } } Mesh mesh = this.gameObject.GetComponent <MeshFilter>().mesh; mesh.vertices = vertices; mesh.uv = uv; mesh.RecalculateNormals(); this.gameObject.GetComponent <MeshCollider>().sharedMesh = mesh; }
// Update is called once per frame void Update() { Vector3 pos = this.transform.position; this.transform.transform.position = new Vector3(pos.x, waterVolume.getHeight(pos.x, pos.z), pos.z); }