Here goes another problem.
I have something like:
This bit does the rotation, then in the display method, or rather, draw mathod, the code looks like:Code://if 'a' key is hold.
if(aHold)
{
Quaternion temp = Quaternion(30, 0, -1, 0);
player->ori *= temp;
player->ori.normalise();
}
what happens now is that when I hold 'a' key, the ship will rotate to the left, however after a small amount of ratation, it resets to the original orientation. Then it start rotating to the left again. This keeps going very fast and looks like vibration.Code:void spaceship::draw()
{
if (alive)
{
glPushMatrix();
glTranslated(position.x, position.y, position.z);
glRotated(ori.r, ori.i, ori.j, ori.k);
glCallList(starfighter);
glCallList(engine_glow);
glPopMatrix();
}
}
Any idea where I might have done wrong?