Calculate point in direction

Started by
1 comment, last by szecs 13 years, 3 months ago
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]
If this post was helpful please +1 or like it !

Webstrand
Advertisement
Are these assignments correct?
If this post was helpful please +1 or like it !

Webstrand
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.

This topic is closed to new replies.

Advertisement