//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]
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:
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!)
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