Jump to content
  • Advertisement
Sign in to follow this  
coderWalker

Calculate point in direction

This topic is 2851 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 want to have the camera look from x,y,z to xtmp,ytmp,ztmp.
For some reason the camera dips down really quick when turning around. I included the code i'm using below.
The Z axis is up.
and the X and Y the player walks on.
This is for 3d mouselook.
Anyone see a problem?

Thanks


float xTmp=player1->x+cos(player1->zRot*3.14/180);
float yTmp=player1->y-sin(player1->zRot*3.14/180)-cos(player1->yRot*3.14/180);
float zTmp=player1->z-sin(player1->yRot*3.14/180)+1;
gluLookAt(player1->x,player1->y,player1->z+1,xTmp,yTmp,zTmp,0,0,1);}


[Edited by - coderWalker on December 30, 2010 9:25:18 AM]

Share this post


Link to post
Share on other sites
Advertisement
I haven't looked at the code carefully, but:

gluLookAt multiplies the current matrix with the "look at" matrix.
Maybe you just need a glLoadIdentity before it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!