Duplicating the orientation of a graph on to a mesh
Unsolved
General and Desktop
-
Hello all,
I have a 3d scatter plot who's orientation I would like to duplicate on a mesh, which is basically a orientation indicator (top-left in the image below).
I use the graph's camara x axis rotation for the mesh's y axis rotation, and the graph's y axis rotation for the mesh's x rotation. This works ok except of course the mesh's z rotation is unaffected.
I've tried the following formula for the rotation of the mesh's z rotation but it is still wonky as you can see from the image.
Zangle = Math.atan2(Math.cos(Xangle * (Math.PI / 180.0)), Math.sin(Xangle * (Math.PI / 180.0)) * Math.sin(Yangle * (Math.PI / 180.0))) * (180.0 / Math.PI) - 90;
I'm sure some value has to be inverted but not sure which. Maybe someone else can see what I can't.
Any help is appreciated, thanks!