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
to quote:
'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.