-
rotation issue
I'm building a cube using other smaller cubes and its being constructed like this:
a = world axis
c = cube
a c c
c c c
c c c
Now I would like to move the axis to the center like this:
c c c
c a c
c c c
Currently my code looks like this:
Code:
glTranslate(0,0,-20);
glRotatef(rot,0,1,0);
for (int i = 0; i < 3; i++)
{
... 2 more for's
glPushMatrix();
glTranslatef(...);
drawCube();
glPopMatrix();
}
How can I change the world axis to the center of cube?
-
So you have like 9 small cubes inside one big one? In that case you would subtract of all coordinates. If L is the length of a cube you would do like (x-L, y-L, z-L) for every cube that has coordinates (x,y,z), counting lets say from the top-right-deep corner.
But it depends on what you mean transfer the center. What is your intention?
-
What I would like is to rotate the cube[around its center] and not the world axis.