Hello,

Instead of giving you what you want, I’ll try my best at explaining how you can come to the conclusion yourself:

Lets take a look at the pieces of code that are most likely to do with our problem.

Line 10:

```
// Smoothly tilts a transform towards a target rotation .
```

Line 15:

```
transform.rotation =
```

I think thats a pretty good indication that the code in that area is what we are looking for. So lets examine those lines:

Line 11:

```
var tiltAroundZ = Input.GetAxis("Mouse X") * tiltAngle * 2;
```

That looks like it’s getting the rotation around the Z axis for the movement of the mouse on the X axis (so sideways). Of course there are some more calculations there, but if you extract the obvious it’s quite easy to determine what this code does.

Line 12:

```
var tiltAroundX = Input.GetAxis("Mouse Y") * tiltAngle * 2;
```

That looks exactly like `Line 10`

but obviously for rotation around the X axis for mouse movement vertically (Y axis).

Line 13:

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

The *first* thing on your mind when reading this line was probably: What in gods name is a `Quaternion`

?

Well, what do we do if we want to find something out? We google it:

`a complex number of the form w + xi + yj + zk, where w, x, y, z are real numbers and i, j, k are imaginary units that satisfy certain conditions.`

definition by google

So lets look at what the Unity Documentation says about it:

`Quaternions are used to represent rotations.`

from here

So there we have it. They are for rotations. So while were at it, lets also look at the `Euler`

function the code is using:

`Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).`

from here

So now we know that that code is making a rotation that rotates around the X axis if we move the mouse horizontally and around the Z axis if we move it vertically.

Now you should already know how to remove the rotation around the Z axis, however I will still go on over the next two lines:

Line 14-15:

```
//Dampen towards the target rotation
transform.rotation = Quaternion.Slerp(transform.rotation,
target,Time.deltaTime * smooth);
```

Without looking at the documentation and just reading the comment we can already assume that `Quaternion.Slerp`

is some function that dampens between two rotations. We can also determine what each of the variables in the function represent. First must be the starting rotation we dampen from. Second must be the rotation we are damping to and third is probably some sort of damping variable.

Of course we could use the documentation to confirm our observation, but who needs documentation when it’s *that* easy to figure out?

Because of this we can backtrace the problem and figure out how to do what we want to do:

The rotation is set from a damping function taking a target rotation as an argument. This target rotation is a Quaternion created from two separate axis rotations calculated from mouse movement.

This pretty much outlines the process I would follow if this was my first time seeing some Unity code. This all pretty much happens during the reading of the code, but if you asked any good programmer (even ones with no experience what so ever in game development) they would all give you the same (and correct) answer just through observation and basic principles.

I suggest you aim at learning *how* to program, before you try solving problems like this (especially if it’s not your code and you don’t understand how it works). The *last* thing to do is ask other people (whom you don’t know) for input on the problem. Before that should be at least a couple hours of research into the problem. Learning everything about it in hope that the solution comes by itself.

Hope this helps,

Benproductions1