• Advertisement

#### Archived

This topic is now archived and is closed to further replies.

# gluLookAt for in_game_world_objekts?

This topic is 6041 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I have a 3D game world! I use gluLookAt to set the "camera" , so that i see the world from the right pos, in the right direction. In my world, i have a ship! It have a position, a facing_direction_vector, and a up_direction_vactor! How can i use these vectors to rotate and transforme the ship? I think i need to use glPushMatrix, and glPopMatrix to set and restore the world matrix, but what about the code betwen? Please help! :-) -Anders-Oredsson-Norway-

#### Share this post

##### Share on other sites
Advertisement
It depends on where the ship is pointing from the start without roatations. glRotate is used to rotate around any arbitary axis.
Why not give it a try before asking for help?
You can start by identify the axis you want to rotate around.

#### Share this post

##### Share on other sites
Thats my problem! I will not use degrees, but instead i use directional vectors! This is because of my physic engine!

-Anders-Oredsson-Norway-

#### Share this post

##### Share on other sites
Pull out a geometry or trigonometry book. If you know the two vectors, you can find the lenth of the arc within the circle/ellipse defined by those vectors.

#### Share this post

##### Share on other sites
It is probably easier to solve a less general problem. If you just want the rotation around the y axis can you calculate it from the x and z part of the direction vector.

#### Share this post

##### Share on other sites

• Advertisement