Equivalent to localToWorld for rotations?

I’m wondering if anyone has a method for getting and setting global rotation values. Currently the rotation works by rotating around local x,y then z axis, but I was wondering if it would be possible to apply the rotations as global x, global y, then global z. Further, I want to be able to get the global x,y and z rotations that would achieve the current operation. The end result should be the ability to convert from global axis rotations to local and back again.

Note. If found this:


But it is targeted at rotating around a single axis, rather than setting xyz all at once, and calling it three times would be excessive for every-frame-calculations where performance is paramount.

Hello GCF,

Can you give us more details about your setup? (object count, types, …)

The object contains the local rotation transforms and you can get the world applied rotations with the getWorldRotation member function. Will this gives you what you need?

Here is the Object3D doc with all the details:
https://threejs.org/docs/index.html#api/core/Object3D

Thanks!! .getWorldRotaion() seems to work for the get part of the problem. Sadly there doesn’t seem to be a .setWorldRotation to go with it :confused: though.

It will depend on your use case, but if you create a parent object and apply some rotation, it will be treated as a setWorldRotation though…