I have a very interesting question that is boggling my mind. (I can’t find reference or a book about this)
Preceived Outcome:
Gameobject aka “Ship” is on the plain mesh “water” and waves come in that move the position/rotation of the ship to look ‘realistic’.
Problem:
I’m using “water” mesh filter changes shape and does not impact x,y,z. I’m using Mathf.Sin in a loop with baseheight to get new values for mesh.RecalculateNormals() that creates the wave like motion. How can I get the coordinates of the baseHeight and tell my ship it needs to raise or lower on the “water” plane? //wave script Mesh mesh = GetComponent().mesh; if (baseHeight == null) baseHeight = mesh.vertices; vertices = new Vector3[baseHeight.Length];
for (int i = 0; i < vertices.Length; i++) { Vector3 vertex = baseHeight*;* vertex.y += Mathf.Sin(Time.time * speed + baseHeight.x + baseHeight.y + baseHeight_.z) * scale;_