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 = 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 to it, three arguments.
Try typing Quaternion.Euler(
into your Script, and reading the tooltip that pops up. The Euler
function needs three arguments of type float
. Notice also that there's a little page 1/2 indicator in the tooltip. If you press the down arrow on your keyboard, you'll see that this method will also take one argument of type Vector3
. We've seen the Vector3
class before (earlier in this chapter). A quick trip to the Script Reference...