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

Right on target

Last but not least, let's look at how we get that target Quaternion. We know why we need it: because we have to feed a to Quaternion to the Slerp() function. To better understand the penultimate line, let's break it down like we did before.

var target = Quaternion.Euler (tiltAroundX, 0, tiltAroundZ);

We're creating a variable called target, which is a bucket. Then, we're putting something in that bucket that we know is going to be of type Quaternion. We're calling the Euler function of the Quaternion class and passing it one argument.

Wait, did he just say "one" argument? I count three. Yes, but try typing Quaternion.Euler( into your Script, and reading the tooltip that pops up (sorry, Mac users, no tooltip for you. Try the Script ...

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