Jump to content
  • Advertisement
Sign in to follow this  
sheepsteak

Camera problem

This topic is 4608 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've used a camera tutorial that I found on Flipcode. I'm having trouble with the rotations but the translations seem fine. I'm using GLUT and my mouse callback looks like this:
void Mouse(int pX, int pY)
{
	static int lastX, lastY;
		
	if(pX > lastX)
		gCamera.RotateLocal(-1.0, 0.0, 1.0, 0.0);
	else
		if(pX < lastX)
			gCamera.RotateLocal(1.0, 0.0, 1.0, 0.0);

	if(pY > lastY)
		gCamera.RotateLocal(-1.0, 1.0, 0.0, 0.0);
	else
		if(pY < lastY)
			gCamera.RotateLocal(1.0, 1.0, 0.0, 0.0);

	lastX = pX;
	lastY = pY;
}



If you try the compiled exe from here and hold down a mouse button and rotate the pointer in circles you will see how it goes wrong. The teapot starts to rotate around the Z axis. If you do circles in the other direction then it goes back. Use W, A, S and D for FPS-like movement. Any ideas how I can stop this from happening?

Share this post


Link to post
Share on other sites
Advertisement
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!