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
Rotation on X occurs on Z
Re: Rotation on X occurs on Z
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 :-(
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Rotation on X occurs on Z
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
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