Hello!
Math isn’t my strongest subject, so apologies if this sounds like a silly question but, why do we declare the variable: [Range(0,1)] [SerializeField] float movementFactor;
at the start of our code, and then in Update() move the platform by setting movementFactor to:
movementFactor = rawSineWave / 2f + 0.5f;
Vector3 offset = movementFactor * movementVector;
transform.position = startingPos + offset;
Would it be incorrect to remove movementVector altogether, and calculate the offset by doing:
Vector3 offset = rawSineWave * movementVector;
transform.position = startingPos + offset;
I know that by doing this, when I set movementVector, in code or in the Inspector, to something like
[SerializeField] Vector3 movementVector = new Vector3(0f, 10f, 0f);
that my platform will now move 10f in both directions, as opposed to 5f in each, but if anything this makes more sense to me.
Thanks in advance,
Sincerely,
Not mathematically inclined