-
A little math help…
Hey guys…
I’m a little stumped here. I am using Math.sin() and want the sine to go from 0 to 1 rather than -1 to 1.
What I am confused about is that, from what I understand, by the order of operations, both expressions should put out the same result. From what I remember, everything in the parenthesis go first then everything on the outside goes next * / + – in that order. But I get two different results, the first expression gives a result of 0 to 400 and the second expression gives a result of 0 to 1.
Thanks in advance…
Stephen =]
First expression, bad result...x = transform.position[0];
y = 2 / (1+ Math.sin(time * 2 * Math.PI));[x, y]
Second expression, good result
x = transform.position[0];
y = (1+ Math.sin(time * 2 * Math.PI)) / 2;[x, y]