Frenzy123
08-10-2009 00:31:37
Hi guys, need a little bit of help with rotations in ogre newt.
I want to move an object in a specific way. Using a cannon mounted on wheels as an example. I want to rotate the object on the y axis according to the worlds y axis, not the objects axis, as any rotation in any other axis will cause the objects y axis to not be fully vertical. Using Ogre Newt I am using the following code...
vTorque is a vector, if I require the object to rotate in the Y axis vTorque.y will be given a value. The problem occurs when i rotate the object from its stationary position about the x axis and then by the y axis, If i make the object do a full 360 rotation about the Y axis now the object is tilted and rotation does not take place about the worlds Y axis.
Refering back to the cannon on wheels example, if i rotate the object about the x and the about the Y, I want the wheels to stay firmly on the ground and rotate the object with the cannon barrel staying the same angle off of the ground with any turn about the Y axis. However at the moment it wouldnt, after for example a rotation in the x axis of 180 degrees the wheels would be up in the air and the tip of the barrel would be buried in the ground.
I realise this may be hard to grasp especially as my explanation may not be very clear but any help or suggestions is appreciated thankyou.
I want to move an object in a specific way. Using a cannon mounted on wheels as an example. I want to rotate the object on the y axis according to the worlds y axis, not the objects axis, as any rotation in any other axis will cause the objects y axis to not be fully vertical. Using Ogre Newt I am using the following code...
vTorque = GetBodyOrientation()* vTorque;
body->setOmega(vTorque);
vTorque is a vector, if I require the object to rotate in the Y axis vTorque.y will be given a value. The problem occurs when i rotate the object from its stationary position about the x axis and then by the y axis, If i make the object do a full 360 rotation about the Y axis now the object is tilted and rotation does not take place about the worlds Y axis.
Refering back to the cannon on wheels example, if i rotate the object about the x and the about the Y, I want the wheels to stay firmly on the ground and rotate the object with the cannon barrel staying the same angle off of the ground with any turn about the Y axis. However at the moment it wouldnt, after for example a rotation in the x axis of 180 degrees the wheels would be up in the air and the tip of the barrel would be buried in the ground.
I realise this may be hard to grasp especially as my explanation may not be very clear but any help or suggestions is appreciated thankyou.