• Create Account

We're offering banner ads on our site from just \$5!

Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!

### #Actualhawksprite

Posted 10 January 2013 - 11:59 AM

So I started reading up on DFT, I believe I understand a decent bit of the formula now. Allthough I stick have a good bit to go.

It isn't working but this is what I have so far:

	public float getWaveHeight(int index)
{
float t = Time.deltaTime;

float x_n = waveVerticeList[index].x;
float N = meshLength; // Total vertice count
float e = 2.71828f;
float i = Mathf.Sqrt (-1.0f);
float k = index;

float sub = (2 * Mathf.PI) * k * N;

float DFT = x_n * (Mathf.Cos (sub) + i * Mathf.Sin (sub));

Debug.Log (DFT);
// Fallback
return DFT;
}

{
for (int i = 0; i < meshLength; i++)
{
waveVerticeList[i].y = getWaveHeight (i);
}

parentMesh.vertices = waveVerticeList;
//parentMesh.RecalculateNormals ();
}

Is it even in the right path? I'm not 100% sure what i'm doing hahaha.

### #2hawksprite

Posted 10 January 2013 - 11:59 AM

So I started reading up on DFT, I believe I understand a decent bit of the formula now. Allthough I stick have a good bit to go.

It isn't working but this is what I have so far:

	public float getWaveHeight(int index)
{
float t = Time.deltaTime;

float x_n = waveVerticeList[index].x;
float N = meshLength; // Total vertice count
float e = 2.71828f;
float i = Mathf.Sqrt (-1.0f);
float k = index;

float sub = (2 * Mathf.PI) * k * N;

float DFT = x_n * (Mathf.Cos (sub) + i * Mathf.Sin (sub));

Debug.Log (DFT);
// Fallback
return DFT;
}

{
for (int i = 0; i < meshLength; i++)
{
waveVerticeList[i].y = getWaveHeight (i);
}

parentMesh.vertices = waveVerticeList;
//parentMesh.RecalculateNormals ();
}

Is it even in the right path? I'm not 100% sure what i'm doing hahaha.

### #1hawksprite

Posted 10 January 2013 - 11:59 AM

So I started reading up on DFT, I believe I understand a decent bit of the formula now.  Allthough I stick have a good bit to go.

It isn't working but this is what I have so far:


</p><div>public float getWaveHeight(int index)</div>
<div>{</div>
<div>float t = Time.deltaTime;</div>
<div> </div>
<div>float x_n = waveVerticeList[index].x;</div>
<div>float N = meshLength; // Total vertice count</div>
<div>float e = 2.71828f;</div>
<div>float i = Mathf.Sqrt (-1.0f);</div>
<div>float k = index;</div>
<div> </div>
<div>float sub = (2 * Mathf.PI) * k * N;</div>
<div> </div>
<div>float DFT = x_n * (Mathf.Cos (sub) + i * Mathf.Sin (sub));</div>
<div> </div>
<div>Debug.Log (DFT);</div>
<div>// Fallback</div>
<div>return DFT;</div>
<div>}</div>
<div> </div>
<div>{</div>
<div>for (int i = 0; i < meshLength; i++)</div>
<div>{</div>
<div>waveVerticeList[i].y = getWaveHeight (i);</div>
<div>}</div>
<div> </div>
<div>parentMesh.vertices = waveVerticeList;</div>
<div>//parentMesh.RecalculateNormals ();</div>
<div>}</div>
<div>

Is it even in the right path?  I'm not 100% sure what i'm doing hahaha.

PARTNERS