Educated guesses
These are the two lines from our code we'd like to better understand:
var target = 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 ...
Get Unity 3D Game Development by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.