# Animate one side of a plane

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();
}
}*_

What do you mean by ‘side’? The ‘front’ vs ‘back’ or some edge? A Plane (the default Plane mesh in Unity that is) has a grid of triangles, that seems to be what you are adjusting here. There is just the mesh. Each ‘side’ of each triangle is part of that triangle.

If you need the other ‘side’ to be a flat plane, while the animating ‘side’ moves on top of that, add another plane and don’t animate it. And probably flip it 180 degrees so it points the ‘other’ direction.

I want to animate the top edge of the plane. Should I somehow select only the top edge triangles and add a sineanimation to them?. How would I do that?