Sign in to follow this  
3dnewbie

freelook fps always rotating around 0,0 (wide orbit)

Recommended Posts

Hi, I use this to fake a pseudo freelook like in fps, but it always rotates around coordinate 0,0. So when i go left a bit, the orbit increases because it stills rotates around 0,0, even though 0,0 is not in the centre anymore. It would like it to always rotate around the center of the screen. I hope you know what i mean. How would i go about doing this ?
	/* Rotations for FREELOOK */
	if(FREELOOK) {
	if(init) {
	user_x=user_x_prev; 
	user_y=user_y_prev;
	init=0;}

	glRotatef(user_x,1.0f,0.0f,0.0f);
	glRotatef(-user_y,0.0f,0.0f,1.0f);
	user_x_prev=user_x;
	user_y_prev=user_y;}
	else {
	init=1;}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this