I’m working on creating a rolling wave (looping it so it repeats eventually). I’ve gotten this far and it kind of does what I need but it’s crazy choppy. I’m not certain what’s causing this and/or how to fix it.
var scale = 3.0;
var speed = 1.0;
private var Count;
private var baseHeight : Vector3[ ];
function Update () {
var mesh : Mesh = GetComponent(MeshFilter).mesh;
if (baseHeight == null)
baseHeight = mesh.vertices;
var vertices = new Vector3[baseHeight.Length];
//for (var i=0;i<vertices.Length;i++)
for (var i=0;i<vertices.length;i++)
{
var vertex = baseHeight*;*
- Count=5- Time.time;*
_ //if (baseHeight*.x == Count)_
_ //{_
_ // vertex.y += Mathf.Sin(Time.time) * scale;_
_ //}_
if(baseHeight_.x >= Count-1 baseHeight.x <= Count +1)
{
vertex.y += Mathf.Sin(Count) * scale+scale;
}
else*
* {
vertex.y = 0;
}
vertices = vertex;
}
mesh.vertices = vertices;
mesh.RecalculateNormals();
}*
Any help would be greatly apprecieated._