How do I select only one side of a plane and only animate that?
I found a pice of code that does almost this, but it animates the whole plane instead of just one side. The goal is to get one side to kinda look like waterwaves. A sine wave would perhaps work?.
using UnityEngine;
using System.Collections;
public class wave : MonoBehaviour {
private float scale = 3f;
private float speed = 1f;
private Vector3 baseHeight;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Mesh mesh = GetComponent<MeshFilter>().mesh;
if (baseHeight == null)
baseHeight = mesh.vertices;
var vertices = new Vector3[baseHeight.Length];
for (int i = 0; i < vertices.Length; i++)
{
Vector3 vertex = baseHeight*;*
vertex.y += Mathf.Sin(Time.time * speed+ baseHeight_.y) * scale;
vertices = vertex;
* }
mesh.vertices = vertices;
mesh.RecalculateNormals();
}
}*_