Hi there, i have been struggling with an issue these last days, and
feel completely stuck. I hope someone here can point me in the right
direction.

The Scenario:
On my scene, i have a number of cubes. Over the course of the
application, these cubes can get rotated on all three axes
individually. At some point i need to target a group of them and
rotate them all along one of the global axes. Check this image to
explain a bit better visually:

http://www.perkstoveland.com/downloads/axis_orientation_fig.jpg

Now these cubes will always be rotated at 90 degrees in any direction,
so an axis of a given cube will always align with either the x, y, or
z axis in  global space. Imagine I want to rotate both cubes in the
figure above, on the global axis X. Cube 1 will need to rotate on its
own x axis, since cube 1's orientation is aligned exactly to global
space. However, Cube 2 needs to rotate on it's y axis, since cube 2's
y axis is the axis that corresponds to the global x axis.

The Question:
How is it possible for me to calculate which axis i need to rotate a
given cube on, when i know the cubes orientation, and the global axis
i want to rotate it on? In other words, how do i translate the global
axis i want to rotate the cube on, to the local axis of the cube?

Any help here would be much appreciated. If something is unclear here,
please let me know.

Perk

Reply via email to