Hey guys,
I’m new to coding and not great at Maths, please be patient with me haha.
I’m referencing this code from the Oscillator script:
myTime += Time.deltaTime;
float cycles = myTime / period;const float tau = Mathf.PI * 2;
float rawSinWave = Mathf.Sin(cycles + tau);movementFactor = rawSinWave / 2f + 0.5f
Vector3 offset = movementFactor * movementVector;
transform.position = startingPos + offset;
I’m following up until we hit:
movementFactor = rawSinWave / 2f + 0.5f;
My question is, why at this point do we divide the result of rawSinWave, which to my understanding somewhere between -1 and +1, by 2?
I’ve probably over thought it at this point so I thought best to just ask!
Thanks