[MX] 3d rotation stuff

• 03-17-2005, 05:55 AM
charlie_says
[MX] 3d rotation stuff
Ok, So I downloaded a really good 3d tutorial (from Kirupa shhh..) and I have been fiddling around with it and have hit a snag.
It rotates the cube correctly in the x and y axes, but the z axis doesn't seem to work properly. My understanding of geometry is not what it was, and the chances are it was never up to 3d transformations anyway.
If anyone can be bothered to stretch their head with it for a bit, I'd love some ideas as to why it's not working?
cheers.
• 03-17-2005, 09:05 AM
ericlin
Quote:

why it's not working
fla here ?
• 03-17-2005, 09:11 AM
charlie_says
gah.. the old don't attach the fla trick.

ps.
Eric - seeing as you'll guess it's me... once I trialled your rotating cube thing, I realised that in actual fact that won't work :( , so I was trying something new....
• 03-17-2005, 09:39 AM
ericlin
I checked the fla you post. Seems nothing wrong.
The z rotation is control by 'control' key and 'shift' key.
I do see the cube rotates around the z axis.

There is no line between the balls, It is iso 3d, no scaling or fading according the z value, so maybe it is difficult to perceive the rotation around z.
• 03-17-2005, 10:02 AM
ericlin
OK, for some reason the function make2DPoint, set the scaleRatio universarily 0.5 , I set the point.scaleRatio=scaleRatio; Then the 3d transform effect appear. Need correct the swapDepths.

Well, I know your problem know. When x, y and z are not 0, the geometry about x,y,z is deformed, because it rotate x first and then y and then z. The rotation has "xyz sequnce". (x,y,z are not independent); However, the z is the last one, so z rotation is always perfect. It is the x and y that gets wrong.
• 03-17-2005, 10:04 AM
charlie_says
Yes, I took the scaling out to make it iso.
If you try this, start on the 'front face' rotate all 3 axes (separately) and then return it to the start position. They all move correctly.
If you then rotate the X axis by 90 degrees (left or right arrow) and try the same experiment, the Y and Z movement is the same whereas I would have expected it to switch (as in the up/down arrows) would cause a clockwise/anticlockwise rotation, and the shift/control buttons would cause a rotation accross what is the horizontal axis (y).
• 03-17-2005, 10:46 AM
ericlin
:)
I guess you believe the x, y, z axis represents the direction passing through the center of sideFace, topFace and frontFace. You believe those axis should change following cube rotation.

In fact, the x, y, z axis are mean to fixed in 3d space. So, the z rotation always clockwise, counterClockwise. If the z rotation is 0, then the x rotation is always a forward-backward rotation. If the z and x rotation is 0, then the y rotation is always the turning of sideFaces. (Sorry, the sequence in the fla script shows y,x,z).

Think about this. Y rotation goes before z rotation. If we rotate y only, the cube rotates around the axis of topFace. Then we tilt the topFace a little by z rotaion. Now, each y rotation result is followed by a z tilt. So, the rotation is not around Y axis, but around the axis of topFace. However, this is not mean to do so by 'y' rotation.
• 03-18-2005, 09:04 AM
charlie_says
Ok
So, I played around with both erclin's and senocular's stuff, and it didn't work out for me, so there was only one thing for it - do it myself.
Here attached is my 3d rotating cube (gfx still from senocular/kirupa)
It works in the way I want (no z rotation, I don't need that) but I would like the rotation to be 'around the face' rather than thru a fixed axis, but so far so good....