How to realize rotation in two steps?
I need to rotate object as presented on scheme.
How to realize rotation in two steps
I think this is basically what i've been trying to do today.
What i wanted to do was to rotate my node backwards, on the x axis, and also at the same time rotate it on the y axis so it spins around. But the result i got was for it to spin around wildly, not how i wanted it to. I think i realise why it does this. it firstly rotated on one axis and then rotated on the next without "resetting" the axis so the next rotation would not be affected by the previous one... I'm not sure if that will make sense to anyone
I'm not sure if i've got some code that i've done before which would take care of this problem or not but it's just confusing me quite a lot
What i wanted to do was to rotate my node backwards, on the x axis, and also at the same time rotate it on the y axis so it spins around. But the result i got was for it to spin around wildly, not how i wanted it to. I think i realise why it does this. it firstly rotated on one axis and then rotated on the next without "resetting" the axis so the next rotation would not be affected by the previous one... I'm not sure if that will make sense to anyone
I'm not sure if i've got some code that i've done before which would take care of this problem or not but it's just confusing me quite a lot
First off, the images show a rotation along Y and then a translation along Y. I don't see two rotations.
If you want to do multiple rotations, you should be able to create a matrix for each, and then apply them to a final composite matrix...
If you want to do multiple rotations, you should be able to create a matrix for each, and then apply them to a final composite matrix...
Code: Select all
core::matrix4 m;
m.makeIdentity();
// later
core::matrix4 r1;
r1.setRotationDegrees(core::vector3df(0, 135, 0));
// later
core::matrix4 r2;
r2.setRotationDegrees(core::vector3df(90, 0, 0));
m *= r1;
m *= r2;
Hi!
I have a problem using this stuff:
I want to rotate the direction of my node using the keyboard, so I plus the roll_inc variable to the Y angle. And then, keep a constant inclination at the Z angle.
This code make a rare behavior,
the r1 matrix´s Y component ranges between [272,271,....,0,1,....82] and do not exceeds that limits (272-82)
Besides it I do not obtain the result of doing a rotation in two steps,
the results are the same that making the common rotation
node->setRotation( vector3df( 0, node->getRotation().Y+roll_inc, 30) );
I hope that i explain myself,
Tnx in advance!!
I have a problem using this stuff:
Code: Select all
core::matrix4 m;
m.makeIdentity();
// later
core::matrix4 r1;
r1.setRotationDegrees(core::vector3df(0
, node->getRotation().Y+roll_inc)
, 0));
// later
core::matrix4 r2;
r2.setRotationDegrees(core::vector3df(0, 0, 30));
m *= r2;
m *= r1;
node->setRotation( m.getRotationDegrees() );
This code make a rare behavior,
the r1 matrix´s Y component ranges between [272,271,....,0,1,....82] and do not exceeds that limits (272-82)
Besides it I do not obtain the result of doing a rotation in two steps,
the results are the same that making the common rotation
node->setRotation( vector3df( 0, node->getRotation().Y+roll_inc, 30) );
I hope that i explain myself,
Tnx in advance!!
------------------------------------------------
Irrlicht Ussers Map
Join now!!
http://www.frappr.com/irrlichtusers
Irrlicht Ussers Map
Join now!!
http://www.frappr.com/irrlichtusers