3d - z rotation question!

i’ve been working with Senocular’s tutorial for 3D scripting :
http://www.kirupa.com/developer/actionscript/faces_depths.htm

//great work, by the way
I made a drag function for it :)… My question is how to change the code
to actualy rotate on the z axis of the cube …
In his tutorial the cube rotates around the z axis of the stage no matter how other axis are rotated.
I think the part of the code that needs to be changed in order to simulate a more realistic rotation on z axis is :
// perform the rotations around each axis
// rotation around x
xy = cxy - sxz;
xz = sxy + cxz;
// rotation around y
yz = cyxz - syx;
yx = syxz + cyx;
// rotation around z
zx = czyx - szxy;
zy = szyx + czxy;
but i never been very good with trigonometry ! and I AM a newbe!:crazy:
Can anyone help me with this please!:esmirk: [SIZE=2][/SIZE][SIZE=2][SIZE=3][/SIZE][/SIZE]

rotation around z-axis:

That’s assuming that the z-axis isn’t rotated, the ideas discussed here take into acount the rotation of the axis
http://www.kirupa.com/developer/actionscript/trig_multiple_axis.htm

The code you posted also takes into account the rotation of the z-axis, excpet in those movies the z-axis is never rotated - add this code to the onEnterFrame function to rotate the z-axis with the up/down arrow keys:

cubeAxisRotations.z += (Key.isDown(Key.UP) - Key.isDown(Key.DOWN)) * 0.1;

thanks but that does not help me! … already dit it … what i need is to rotate the z axis with the cube … in the tutorial the z axis is alwasy normal to the stage … my question is how to rotate the z axis ?

thanks but that does not help me! … already dit it … what i need is to rotate the z axis with the cube … in the tutorial the z axis is alwasy normal to the stage … my question is how to rotate the z axis
(my fault …wasn’t very clear in the first place!)

by the way : this is a nice place to lose some time http://ghost.aesthetic.ru/index.htm

so can you help me with this…?:pleased:

can someone PLEASE help… i tried the kirupa tutorial but i just don’t have enough trigonometry knowledge to this:

the code is something like this: (part of it…
x = points*.x;
y = points*.y;
z = points*.z;

    // perform the rotations around each axis
    // rotation around x
    xy = cx*y - sx*z;
    xz = sx*y + cx*z;
    // rotation around y
    yz = cy*xz - sy*x;
    yx = sy*xz + cy*x;
    // rotation around z
    zx = cz*yx - sz*xy;
    zy = sz*yx + cz*xy;

    // now determine perspective scaling factor
    // yz was the last calculated z value so its the
    // final value for z depth
    scaleRatio = focalLength/(focalLength + yz);
    // assign the new x, y and z
    x = zx*scaleRatio;
    y = zy*scaleRatio;
    // create transformed 2D point with the calculated values
    // adding it to the array holding all 2D points
    TransformedPointsArray* = make3DPoint(x, y, z);
}

but the z axis is ALWAYS perpendicular to the stage… i would realy apreciate if someone could help me ajust the code so that the z axis spins with the cube, because in some point i need to roate around the z axis

PLEASE… PLEASE HELP

I’m bumping into the same problem. What have you tried already?
I spend at least one day on this problem. No luck so far.

as far as I can see you don’t want then to rotate cube (you want to rotate AXIS) so basicly you want to rotate camera, not objects

Ok, but that means you have to move the camera too if you want to keep the camera focussed on the object.