Educated guesses
These are the two lines from our code we'd like to understand better:
var target : Quaternion = Quaternion.Euler (tiltAroundX, 0, tiltAroundZ); // Dampen towards the target rotation transform.rotation = Quaternion.Slerp(transform.rotation, target,Time.deltaTime * smooth);
Let's actually start from the bottom up.
In the final line of code, we're setting transform.rotation
to something, which will turn the paddle somehow. That much, we get. We can probably also guess that Quaternion
is one of those built-in classes that we looked at, like Input
—both Quaternion
and Input
start with a capital letter, and light up when we type them.
Slerp
sounds weird, but it starts with a capital letter and has round brackets next to it. We've seen that same structure when we called functions earlier in our code, like Input.GetAxis()
and Debug.Log()
. And, just like those two functions, Slerp()
needs some extra information to do what it does. These are called
arguments, and we've used them a few...