# Rotation

## Recommended Posts

Posted (edited)

Hello @Neo , just a request for the future. Not an important one because we do not use it often directly, and exotic, only a few members will use it at all. So only a wish.

In his studio Neo uses frequent rotations to perform wanted operations of the user. So Neo has already the necessarly tools to do some of the wanted calculations.
This two are already given free :

local t = \$("an object").transformation.rotation -->but not very user friendly because of the quaternion.
and
\$("an object").transformation:rotateZ(math.rad(30)) --> works fine, rotates further over 30° ( z -axis )

But if we want to find the angle an object is already rotated at the moment, or if we want to rotate directly to a specific rotation ( without knowing the actual rotation ), it is not given free.

So I'm thinking of something like the following.  Let us start with 0,0,z' (*)

local a = \$("an object").transformation.rotationZA --> where the result is the actual rotation angle over the z axis in rad. ( here the result is z' )
and of course also
\$("an object").transformation:rotateZA(math.rad(30)) --> where the object will end on the actual rotation of 30° ( z-axis )
( here it should be ok if we only could rotate directly to 0,0,0 , already possible workaround -> rotate equal to an object at 0,0,0)

As I said, only a wish, only should it be possible without much work for Neo.
Kind regards, Herman

( * due to rounding errors, not all rotations over x,y,z are possible in the studio, so my question is specific when an object has two of the 3 angles = 0 , in my case 0,0,z' as said before ) If we fill this angle in, Neo will immediatly rotate to the 55,58 ° as wished. So he has this tool somewhere ?

Edited by Herman
some workaround possible
##### Share on other sites

Hello, since @EASY helped us with the
function quaternion_to_euler(x, y, z, w) , the problem is solved ( for me ).
I only wanted to find the x° y° z° global angles of an object in Lua.

Thank you Easy !

Kind regards , Herman