using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WobbleTest : MonoBehaviour {
    Mesh myMesh;
    // Use this for initialization
    void Start () {
        myMesh = GetComponent<MeshFilter>().mesh;
        myMesh.MarkDynamic();
    }
	
	// Update is called once per frame
	void Update () {
        CalculateChange();
	}

    void CalculateChange()
    {

        List<Vector3> verts = new List<Vector3>();         
        verts.AddRange(myMesh.vertices);

        int i = 0;
        foreach(Vector3 v in verts) { 
            verts[i] = new Vector3(v.x,Mathf.Sin((v.x)+(Time.timeSinceLevelLoad)),v.z);
            i++; 
        }
        myMesh.SetVertices(verts);
        GetComponent<MeshCollider>().sharedMesh = myMesh;
    }
}
