How to set world rotation of a node/mesh?

Hi everyone,

I am struggling to understand how to set the world rotation of a node/mesh.
There is a rotate method but this adds to the rotation rather than setting it:

object.rotate(BABYLON.Axis.X, addValue, BABYLON.Space.WORLD);

How can I set the world rotation of a mesh?
Thank you

Perhaps this will do what you want:

mesh.rotation = BABYLON.Vector3.Zero();
mesh.rotate(BABYLON.Axis.X, addValue, BABYLON.Space.WORLD);

https://doc.babylonjs.com/divingDeeper/mesh/transforms/center_origin/rotation

1 Like