Qwerty
06-12-2000, 08:09 AM
How does gluLookAt(); work???
/******************************/
I have come to understand that the previous post was hard to understand so I will try to explain it more careful this time.
What I am trying to do:
- A spaceship simulator (mush like SpaceWars on NeHe’s Site witch by the way doesn’t work as I want either).
- Control the ship with the Arrow keys.
- The Arrow should represent the ship controls.
This means that if I pull back the controls (DOWN KEY), the ships nose should tilt UP.
And UP KEY should tilt the nose DOWN.
LEFT & RIGHT KEY should SPIN the ship.
- I want the camera to follow the ship.
- I want Asteroids to and they should rotate constantly in the same way.
Problems:
- If I use this for the ship it obviously don’t work.
And it doesn’t work better for the asteroids.
glPushMatrix();
glTranslate(shipXpos, shipYpos, shipZpos):
glRotatef(shipXrot, 1.0f, 0.0f, 0.0f);
glRotatef(shipYrot, 1.0f, 0.0f, 0.0f);
glRotatef(shipZrot, 1.0f, 0.0f, 0.0f);
DrawShip();
glPopMatrix();
Solutions:
- This is where I hoped you fill in.
Thanks you in advance…
/******************************/
I have come to understand that the previous post was hard to understand so I will try to explain it more careful this time.
What I am trying to do:
- A spaceship simulator (mush like SpaceWars on NeHe’s Site witch by the way doesn’t work as I want either).
- Control the ship with the Arrow keys.
- The Arrow should represent the ship controls.
This means that if I pull back the controls (DOWN KEY), the ships nose should tilt UP.
And UP KEY should tilt the nose DOWN.
LEFT & RIGHT KEY should SPIN the ship.
- I want the camera to follow the ship.
- I want Asteroids to and they should rotate constantly in the same way.
Problems:
- If I use this for the ship it obviously don’t work.
And it doesn’t work better for the asteroids.
glPushMatrix();
glTranslate(shipXpos, shipYpos, shipZpos):
glRotatef(shipXrot, 1.0f, 0.0f, 0.0f);
glRotatef(shipYrot, 1.0f, 0.0f, 0.0f);
glRotatef(shipZrot, 1.0f, 0.0f, 0.0f);
DrawShip();
glPopMatrix();
Solutions:
- This is where I hoped you fill in.
Thanks you in advance…