Immoho
17-12-2007 10:30:38
Seriously,I think it's a mathematical problem.
I wanna rotate my collision boxes with the quaternion.Here the code.
They work fine when I just use one of them.
But when I change the x,y coordinates at the same time.It has a wrong rotation.
Because when rotate along the X,or the Y.It's local coordinate system has changed which is the parameter of the second rotation.
The second rotation has a wrong normal
And the funtion,setOrientation() is the only one which can change direciton of torsoTrans!
Somebody Help.Thanks.
I wanna rotate my collision boxes with the quaternion.Here the code.
//along the Y
Quaternion q1 = torsoTrans->getOrientation();
Quaternion q2( Radian( ms.X.rel ),Ogre::Vector3::UNIT_Y );
Quaternion q3 = q1 * q2;
torsoTrans->setOrientation( q3);
//along the X
Quaternion q4 = torsoTrans->getOrientation();
Quaternion q5( Radian( ms.Y.rel ),Ogre::Vector3::UNIT_X );
Quaternion q6 = q4 * q5;
torsoTrans->setOrientation( q6);
They work fine when I just use one of them.
But when I change the x,y coordinates at the same time.It has a wrong rotation.
Because when rotate along the X,or the Y.It's local coordinate system has changed which is the parameter of the second rotation.
The second rotation has a wrong normal
And the funtion,setOrientation() is the only one which can change direciton of torsoTrans!
Somebody Help.Thanks.