Rotation on X occurs on Z

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
azerty69
Posts: 11
Joined: Tue Jun 11, 2013 1:33 pm

Rotation on X occurs on Z

Post by azerty69 »

Hello community,

I'm encountering a strange problem. I want to rotate my model on X and the rotation
occurs on Z. I use Irrlicht 1.8.4 and the OpenGL driver. Rotations on Y and Z are working perfectly.

(...)

rotation.X += ...

(...)

// Apply new values to the ship.
shipNode->setPosition(position);
shipNode->setRotation(rotation);

I hope someone can help,
azerty69
CuteAlien
Admin
Posts: 9645
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Rotation on X occurs on Z

Post by CuteAlien »

Maybe not enough information. But basically full 6 degrees of freedom with euler angles can be tricky. If you just go on adding rotations to all axes the result is often now what you expect. Stuff like gimbal lock and one axis suddenly meaning something different happening.

What you want in this case is usually rotations added to the current local orientation (not to global axes). I posted some rotateAxesXYZToEuler function once in the past which might work for you here: http://irrlicht.sourceforge.net/forum/v ... =4&t=52136

edit: But no guarantee it really works... I realized when reading that old thread that I didn't really test this for the 6-dof use-case. I should probably do that :-(
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
azerty69
Posts: 11
Joined: Tue Jun 11, 2013 1:33 pm

Re: Rotation on X occurs on Z

Post by azerty69 »

Hello CuteAlien,

Thank you for your reply. I've found where my problem was coming from.
At initialization, I was rotating my model of 90 degrees on Y to obtain a good
orientation. I've modified the orientation of the model with Blender and removed
the following lines from my init code:

rotation = vector3df(0.f, 90.f, 0.f);
shipNode->setRotation(rotation);

Now, the ship reacts correctly.

Thank you again for your reply,
azerty69
Post Reply