Not sure how others feel but the second half of this lecture was the first time I felt really lost in this course. I sort of understand that Rick is setting up a principle of coding for later use, but in practice the code seems much easier to understand before and just as short (so maybe it was just not a great example?)
He also seemed to speed through this bit as if it was all self explanatory?
Reading the comment below: [Project Boost: Cleaning code here is confusing] made me even more confused
'The value of the blahblahblah variable. void ApplyRotation (float notblahblahblah) and then the variable blahblahblah will be “transfered” to the variable notblahblahblah to use in that code? Exactly. ’
The ‘Exactly’ is doing some really heavy lifting there…
Hoping it will make more sense later on - otherwise, this may be the point I start realising coding is not for me
Okay…had another stab at understanding it:
We are adding a new parameter to go after ApplyRotation() we are calling this ‘rotationThisFrame’ but it might as well be called ‘blahblahblah’ for our purposes.
Our purpose is: in case we had dozens of ApplyRotations in our script and we wanted different values in each parameter - it looks tidier to have ApplyRotation(changed variable) than:
transform.Rotate(Vector3.forward * rotationThrust * Time.deltaTime);
transform.Rotate(Vector3.forward * -rotationThrust * Time.deltaTime);
etc. times 12
So, by adding a parameter to our method (ApplyRotation) we are saying everything else in our method stays the same except for parameter ( float variable Blahblahblah)
where Blahblahblah/‘rotationThisFrame’ stands in for whatever we want to alter, in this case ‘rotationThrust’ being negative or positive.
Even as I write that my head hurts slightly…hopefully that’s a sign I’m learning something, not that my head is about to explode.