I’m just learing Java3D and for the first project I want to make the BlockOut game. The problem I have is about rotation.
Rotating the visual representation of active block is done by six keys, two per axis, one adds, one subtracts 90 degrees. If I do rotation with three Transform3Ds(each for one axis) multiplied together, the effect is not ok.
I understand the reason: this way of rotation shifts axes. For example, rotating something round x axis for 90 degree, shifts y axis to the position of z axis. The y rotation is then done around the original z axis, not original y axis as wanted. And so on for z rotation. But I want the pressing of certain axis keyboars keys to rotate the visual block in that axis exactly.
Now, I also know how to solve this problem mathematicaly for each point, I’ve done it for the data representation which is 3-dimensional array. Simplified version:
(x,y,z) - 3Dpoint
//x rotation for 90deg
(y,z) = rotate point (y,z) round x axis(2d rotation) for 90deg
and repeat this for other two axis.
Notice that the result of x rotation is used in y rot and this one in z rotation.
Now the real question is: how do I do this last type of rotation with Transform3D(thati need to set it to TransformGroup)?