- Home /

# Trigonometry help?

So I'm trying to figure out how to do some basic trig in Unity. I know I'm a little rusty, but this is terribly confusing.

My calculator says Cos(60)*10 = 5, but when I do Mathf.Cos(60)*10, I get -9.52413.

Could somebody un-stupid me?

**Answer** by aldonaletto
·
May 18, 2012 at 11:26 PM

Mathf.Cos expect the angle in radians, not degrees. To make our lives easier, Unity provides the constants Mathf.Deg2Rad and Mathf.Rad2Deg: just multiply the value by the appropriate constant to convert degrees to/from radians. In the example:

```
print("Cos(60) = "+Mathf.Cos(60 * Mathf.Deg2Rad));
```

what will print 0.5

I just like to note that most programming languages use radians in all trigonometric functions. Radians makes from a mathematical point of view much more sense than 0° - 360° which is just a magic number ;)

Exactly - 360 is used due to some obscure ancient reason, but means nothing from a math point of view. This magic number almost became 400 when the metric system was being defined - someone got smart and proposed the *grado*, a "metric flavored" unit to replace the old and dusty *degree* (400 gradi == 360 degrees)

If you ever find a trigo function taking degrees, it's because the conversion is performed inside before calculating the cos. Otherwise, it just wouldn't make sense.

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

### Follow this Question

### Related Questions

Move and Rotate player in circular motion? 2 Answers

simulate a circle move 2 Answers

Creating Objects In Circle Starting at the top. 0 Answers

Mathf.Sin() & Mathf.Cos() 1 Answer

Move object in an arc 3 Answers