O'Reilly logo

Unity 3D Game Development by Example by Ryan Henson Creighton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required