UltraCakeBakery Posted July 11, 2018 Share Posted July 11, 2018 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); Quote Link to comment Share on other sites More sharing options...
davrous Posted July 11, 2018 Share Posted July 11, 2018 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 Arte 1 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 11, 2018 Share Posted July 11, 2018 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! davrous 1 Quote Link to comment Share on other sites More sharing options...
UltraCakeBakery Posted July 11, 2018 Author Share Posted July 11, 2018 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 brianzinn and davrous 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.