I'm not a mathematician, but I'm trying to solve a (javascript) code problem. What I need, if I express correctly, is a formula to get the angles of a 3D object,..knowing its rotation ?
Well, maybe it would be easier to understand with pictures :
I'm working on a javascript animation which consists of a fake 3D cylinder rotating on its Z axis. I've done it within After Effects but whatever, this is a code/maths question.
I have a "Zrot" variable driving some shapes changes, which "simulates" a rotating 3D object on one axis - so this is not 3D but 2D.
Now I need to be able to rotate my layer, but when doing it, the angle looks weird.
What I'm searching for is a formula to calculate a "zrot" offset based on the layer rotation.
var frontRot = 78;
var zRot = -33;
var zRotOffset = frontRot * ...
zRot = zRot + zRotOffset;
If you know some 3D softwares, it is kind of like local rotation VS global rotation.
Can anyone help ? I need something that could be coded in javascript.
Thanks !



