I have been trying to make a apollo like sim.
I realize that the order of rotation being x,y,z. All rotation made on the X axis get totally cancelled by a Y rotation at 90 or 270, rotation possibility increase toward 0 and 180.
Try to make a node rotate on X axis when there is a 90 rotation on Y.
You just can't have the slightest inclination on the X.
It's impossible
That is if you want a certain facing direction from your object. like a car, a boat, a spaceship, a player, etc.
The only way is to keep the camera at its back or to rotate the whole world, can't work with huge map or world.
The workaround would be to modify the matrix routines, but I don't know the engine enough to be sure of the side effect.
I would spend the time if needed, it would be worthwhile. with new order (Y,X,Z) any rotation would be possible. Am I lost or right ?
Any comment, warning, or suggestion would be welcome.
Any helping hand (and neurons) would be welcome
[EDIT]
To make rotation possible in all direction using matrix, one must NOT try to call rotation routine with a final rotation, rotation must be made in increasing steps, and for the node's rotation to cross the 90 & 270 degrees border, one of X or Z axis rotation must be other then zero. I don't completly understand the reason, but it works. I'm using a variable to keep track of the actual node's rotation because if you log the rotation it gives the relative rotation in the order they're made to get the final rotation. here's my code (brief version, ask if you need complete)
Code: Select all
//Update of events action on rotation of vaissel
irr::core::vector3df rolls(0.f,0.f,0.f);
...
switch (key)
{
...
///acitvate attitude controls
case KEY_LEFT: {log_str.append(L"thrustinL",15);
rolls.Z+=roll_speed;
actual_rot.Z+=roll_speed;
rotate(rolls,vaisseau);
make_thrust(ps[1]);break;}
...other keys
//to make actual rotation on vaissel node
void vaissel::rotate(irr::core::vector3df &rotation, scene::ISceneNode * node)
{ irr::core::matrix4 m;
m.setRotationDegrees(node->getRotation());
irr::core::matrix4 n;
n.setRotationDegrees(rotation);
m *= n;
node->setRotation( m.getRotationDegrees() );
node->updateAbsolutePosition();
}
[EDIT]
Regards,
Robert