# Rotating a mesh by degree's

## Recommended Posts

Hey everyone.

Title says it all. How do i rotate an object using degrees? This is how i did it in the past but it doesn't work

``cube.rotation = new BABYLON.Vector3(45, 45, 0);``

#### Share this post

##### Share on other sites

Hi,

Rotations are in radians. You need to convert degrees to radians: https://en.wikipedia.org/wiki/Radian. Radian =  degree * Math.PI / 180

By the way, 45 == Math.PI / 4, 90 == Math.PI / 2 and 180 == Math.PI

David

#### Share this post

##### Share on other sites

You can also convert to radians using BJS tools (https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.tools.ts#L336 :

``var radians = Babylon.Tools.ToRadians(angle);``

And welcome to the forum!

#### Share this post

##### Share on other sites

6 hours ago, brianzinn said:

You can also convert to radians using BJS tools (https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.tools.ts#L336 :

```
`var radians = Babylon.Tools.ToRadians(angle);````

And welcome to the forum!

7 hours ago, davrous said:

Hi,

Rotations are in radians. You need to convert degrees to radians: https://en.wikipedia.org/wiki/Radian. Radian =  degree * Math.PI / 180

By the way, 45 == Math.PI / 4, 90 == Math.PI / 2 and 180 == Math.PI

David

I totally misread the documentation. Should go to bed early next time haha. Thanks guys

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

• ### Recently Browsing   0 members

No registered users viewing this page.