Rotate Viewpoint
I mean like the viewpoint. What the monitor "sees" through.
EXAMPLE. In an FPS, by moving the mouse you rotate the viewpoint.
EXAMPLE. In an FPS, by moving the mouse you rotate the viewpoint.
As I said, glRotate. Get the mouse movements, and feed the movements as angles to glRotate.
For example, if you want to look up/down by moving the mouse up/down, get the mouse movements in the Y-direction, scale it as you like (to "convert" from distance to degrees, choose whatever factor you like; higher factor, higher sensitivity), and rotate that amount about the X-axis. Simple, but works.
For example, if you want to look up/down by moving the mouse up/down, get the mouse movements in the Y-direction, scale it as you like (to "convert" from distance to degrees, choose whatever factor you like; higher factor, higher sensitivity), and rotate that amount about the X-axis. Simple, but works.
Before I go into depth, I''d want to know: Do you want the simplest hack possible, or do you want a movable camera?
"Remember: Silly is a state of Mind, Stupid is a way of Life." -- Dave Butler
"Remember: Silly is a state of Mind, Stupid is a way of Life." -- Dave Butler
Actually, instead of answering the question I'm just going to point you to some OpenGL tutorials that would be many times more helpful than any one post I would make:
http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg1.htm
Edit: Yes, yes, it's not NeHe, I know. But gluLookAt isn't terrible, as best as I can tell, and it does the job.
"Remember: Silly is a state of Mind, Stupid is a way of Life." -- Dave Butler
[edited by - Indigo Darkwolf on January 27, 2004 5:20:27 PM]
http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg1.htm
Edit: Yes, yes, it's not NeHe, I know. But gluLookAt isn't terrible, as best as I can tell, and it does the job.
"Remember: Silly is a state of Mind, Stupid is a way of Life." -- Dave Butler
[edited by - Indigo Darkwolf on January 27, 2004 5:20:27 PM]
At the beginning of your drawing routine (after positioning the camera) i use glRotatef(xrot,1,0,0) and glRotatef(zrot,0,0,1) which lets the user/player look down (x) and look around the vertical axis (z). This works perfect.
Can''t make heads or tails out of GameTutorials... Mabye im just not getting it. And ill try GLRotate again.
GLRotate works... kinda. See, sometimes your turning to face the square and your turn "rebounds". If you want the code i''d be happy to send it to you. And you have to press the down arrow key to see the square.
Oh, and another thing... You kinda "slide" on a line perpendicular to the square no matter which direction your facing.
Oh, and another thing... You kinda "slide" on a line perpendicular to the square no matter which direction your facing.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement