Hello,
I am currently learning scripting using a third party course called “catlikecoding” - I have come across something which I am having difficulty understanding. The project involves creating a “graph” out of multiple prefab clones along an x axis and then forming different waveforms by using the x axis values to perform trigonomic functions and assigning each value to the Y for each prefab clone.
For creating a “moving ripple”, the course states that in order to animate the ripple, the input parameters for Sin() should be “float y = Sin(PI * (4f * x - Time. time));” I have tried writing it this way and it works, however writing it in the way “float y = Sin(PI * 4f * (x - Time.time));” creates the same shape but moving many times as fast.
The only reason I wrote it this way is because I was curious.
I am having difficulty understanding this, as I ran the calculations for both formulas manually and they both produce the exact same value, which I assume Sin() is reading in the same way. Am I missing something? I assume it has something to do with operational order maybe.
Here is a link to the course lesson I am studying - find the materials under the “how to create a ripple” part.
Thanks!