A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [MX] 3d rotation stuff

  1. #1
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508

    [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.

  2. #2
    Senior Member
    Join Date
    May 2001
    Posts
    1,838
    why it's not working
    fla here ?

  3. #3
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508
    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....

  4. #4
    Senior Member
    Join Date
    May 2001
    Posts
    1,838
    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.

  5. #5
    Senior Member
    Join Date
    May 2001
    Posts
    1,838
    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.

  6. #6
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508
    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).

  7. #7
    Senior Member
    Join Date
    May 2001
    Posts
    1,838

    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.

  8. #8
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508

    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....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center