Degree or radian?

Hi everyone!

Three.js system uses degree or radians to measure the angle?

Thanks,

If you’re working with Euler rotations, they’re in radians. For example, object.rotation is an Euler. There is a MathUtils class to convert from one to the other if you need it: https://threejs.org/docs/#api/en/math/MathUtils.degToRad.

1 Like

Thanks @donmccurdy,

What if I wanna rotate an object (a mesh), I probably use something like:

mesh.rotation.set(70, 45, 0);

or
mesh.rotateX(Math.PI/180 * 70);
mesh.rotateY(Math.PI/180 * 45);

The angel are all radians, right?
But which one is prefer to set the angel for the mesh?

Thanks,

It’s all radians, yes. The Object3D docs should give more detail.

Any of those methods are OK — I usually do this…

mesh.rotation.x = ...;
mesh.rotation.y = ...;

… but that’s mostly personal preference.

1 Like