Alright, so the code should look sth. like this:
Just to be clear. Calling ApplyRotation(rotationThrust); we want to use the method ApplyRotation using the parameter rotationThrust, which we set to 100 above, so basically ApplyRotation(100).
Now the method is declared as void ApplyRotation(float rotationThisFrame), which means we are basically saying to set rotationThisFrame to 100, like: 100 = rotationThrust = rotationThisFrame.
Is there a reason we cant get rid of one of these variables? Or am I missing an important aspect?
Wouldn’t it be easier to just leave the transform.Rotate… in the if statement?
void ProcessRotation()
{
if (Input.GetKey(KeyCode.A))
{
ApplyRotation(rotationThrust);
}
else if (Input.GetKey(KeyCode.D))
{
ApplyRotation(-rotationThrust);
}
}
void ApplyRotation(float rotationThisFrame)
{
transform.Rotate(Vector3.forward * rotationThisFrame * Time.deltaTime);
}