我一直在努力解决这个问题的最长时间,但似乎没有任何效果。
我基本上试图以任意速度制作行波。
一般来说,我一直试图使用的是涉及平面波动方程式的东西,如果你有Vector velocity
和Point position
,那就是这样:
float pi2 = 2 * PI;
// For our purposes lambda is the speed
float lambda = velocity.length();
// Therefore frequency is 1
float frequency = 1.0F;
// Making angular frequency equal to 2 * PI
float omega = pi2;
// Lambda is the wavelength and pi2 / lambda is the wave number
Vector waveVector = velocity.norm().multiply(pi2 / lambda);
// Theta is the angle from the origin to the new position at time
float theta = waveVector.dot(position.toVector()) - (omega * time);
// Here's where I'm stuck. Psi is equal to the current disturbance of the wave.
// Where do I go from here to get the new coordinates?
float psi = amplitude * cos(theta);
在1维测试,当然这是有效的。其中
float x = speed
和
float y = amplitude * cos((waveNumber * position.x) - (omega * time))
这对我来说很有意义。但对于2维,我会遇到psi。