Skip to main content

How to correct the RotZ error?

No replies
thewulf00
Offline
Joined: 2011-06-17
Points: 0

Hello,

by rotating the viewer around the X and Y axis, the Z axis gets involved.
I have no idea how to correct this error? - Please help!

I tried two implementations:

currXform.mul(currXform, transformY);
currXform.mul(currXform, transformX);

-or-

currXform.setRotation(new AxisAngle4f(1f,y_angle/x_angle,0f,(x_angle)));

The input-variables y_angle and x_angle I am calculating from mouse-inputs.
When I am using only one axis, all is good - no Z-error. But by combining X and Y there is an error. Here is a screen capture: (Left is only one axis, right has both axis)

The green lines show how the cube got moved.
The yellow box show how the cube should be. There is a rotation around the Z-axis, that I never have set.