I’m not sure if I understood you correctly, so please correct me if the following did not help:
The ApplyRotation method recieves “a value”, and we use that value in the transform.Rotate method. rotationThisFrame
is just a local variable. We do not use the minus here because there is no way to determine the direction based on rotationThisFrame
.
In the ProcessRotation method, we know when we want to change the direction. And we pass on that value to the ApplyRotation method.
We could have written this in a slightly different way. Keep in mind that the following method less inefficient than the original ProcessRotation method due to the additional if-statement. This is just an example to visualise an idea:
void ProcessRotation()
{
if (!Input.GetKey(KeyCode.A) || !Input.GetKey(KeyCode.D)) { return; }
Vector3 thrust = rotationThrust;
if (Input.GetKey(KeyCode.D)) { thrust *= -1; }
ApplyRotation(thrust);
}
It does not matter where you “flip” the value of rotationThrust
. We pass on the value of thrust
to the ApplyRotation method, not the variable named thrust
.