- Home /

# Calculate Pitch (-90 to 90) from Euler Angles

I have some trouble converting euler angles to pitch angles for aviation that ranges from -90 (pointing to -Y) and 90 (pointing to +Y). Therefore if exceeding those bounds the final pitch should be substracted again. I have made a sketch to visualize what I want to achieve (grey angles):

I have this code for pitch, but it goes only from 0 to 90.

```
pitch = Vector3.Angle(new Vector3(transform.forward.x, 0, transform.forward.z), transform.forward );
```

**Answer** by Bunny83
·
Nov 29, 2019 at 04:46 AM

To get the pitch angle all you need is this:

```
float pitch = Mathf.Asin(transform.forward.y) * Mathf.Rad2Deg;
```

Thanks, forget to mention that I use 5.6.0.f so this isnt in the API, but I solved it just using `transform.forward.y * 90f;`

- This will give also the correct pitch angle. Thanks anyways guys.

No, this will **not** give you the correct angle. It gives a distorted value. The only correct values would be 0, 90 and -90. All other values are more and more off the further you are between those values. The methods I used certainly exist in Unity 5 since they exist since Unity 1.

However I have miscapitalized the Asin method. I just did my usual CamelCase casing. It's the "arcus sine" which is usually written as "arcsin" or with CamelCase as "ArcSin". Since Unity shorten the "arc" to just "a" they made the "s" small so it's actually called "Asin".

I will fix my answer.

Here's how the difference look like:

Ah, now that makes sense. Thank you again for clarifying! :D

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.