Mesh rotation using Quaternion.RotationAxis

Hi here

i feel like a noob again with my rotation misunderstanding :slight_smile:

i try to rotate a box using Quaternion.RotationAxis and the rotation result look’s wrong.

https://playground.babylonjs.com/ts.html#4KDYJD

need some help, svp.

thx.

It looks like you want to rotate by degrees. BJS uses radians.

2 Likes

Hey lluull
Just like adam said, you’ll need to use radians. You should just be able to throw in a conversion to radians like angleRad = angle / 180 * Math.PI (if you use a new var for the radians, don’t forget to change the var used in the quaternion function call) and that should fix things up for you.

We provide tools for that:

BABYLON.Tools.ToDegrees()

and

BABYLON.Tools.ToRadians()
2 Likes

hehehehe sure i was very noob on this one

thank you adam for pointing me that Babylon use radian :+1:
thank you PolygonalSun for the additional info and the formula :ok_hand:
thank you DeltaKosh to inform about the built-in tool :pray:

thx all of you guy’s :slightly_smiling_face: