Page 1 of 1

Plane yaw problems

Posted: Thu Mar 17, 2005 2:21 am
by harmon
I haven't quite warmed up to the ogre api yet, so please bear with me...

I need to know how to set a fixed yaw axis for a particular sceneNode. When my plane is rotated (looks like it is turning), the local y axis of the node is then also used for yaw. I would like to set a fixed yaw axis for this particular node so that when the plane is rotated it can also turn in the correct fashion.

this is my current yaw code from one of the tutorials that uses a local axis from which to yaw:
mControlNode->yaw(Radian (Degree( mfYaw * evt.timeSinceLastFrame )));

Posted: Thu Mar 17, 2005 2:35 am
by haffax
use SceneNode::setFixedYawAxis(). Some things are just as easy as they sound even if one does not believe it. :)

Posted: Thu Mar 17, 2005 3:29 am
by Robomaniac
make sure you yaw in world space too by setting the last parameter of node->yaw() to Ogre::SceneNode::TS_WORLD (i think)

Posted: Fri Mar 18, 2005 12:00 am
by harmon
ok, I got that working now (thanks to your replies), but now ive run into another problem:
I want the ground to tilt the opposite direction that the plane is turning... so i do this (see below) with the plane and the camera and it works pretty well. The only problem is that it gets kind of "glitchy" but the framerates are still >100 all the time. Maybe im implementing this incorrectly?

Code: Select all

Quaternion qRoll, qPitch;
qRoll.FromAngleAxis(Radian (Degree (mfShipRoll)), Vector3::UNIT_Z);
qPitch.FromAngleAxis(Radian (Degree (mfShipPitch)), Vector3::UNIT_X);    
mShipNode->setOrientation( qRoll * qPitch );
mCameraNode->setOrientation( -qRoll );