Advertisement
Advertisement
| 11.05.2002 at 09:05PM PST, ID: 20391272 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 11.07.2002 at 12:47AM PST, ID: 7418798 |
degrees:
pitchDegrees += pitchAngle;
When the player looks down
degrees:
pitchDegrees -= pitchAngle;
Then, when it comes time to draw your scene, place the OpenGL camera like such:
/// Clear the camera's translation from the previous render frame
glLoadIdentity();
/// Set up the perspective view
gluPerspective( ...... ) // you should already have a line like this in your code
/// Move the camera to the player's position
glTranslatef( -position[0], -position[1], -position[2] );
/// Rotate the view by <yawDegrees> around the Y-axis:
glRotatef( yawDegrees, 0.0f, 1.0f, 0.0f );
/// Rotate the view by
around the new, rotated X-axis:
glRotatef( pitchDegrees, 1.0f, 0.0f, 0.0f );
/// Now draw your objects in 3d space.
Note that we had to use DEG2RAD to convert our angle from degrees (0-360) to radians (0-2xPI), since the cos() and sin() functions take angles in radians. However, we did not have to do this for our glRotatef() command, since it takes angles in degrees.
I'm sure this is probably confusing and/or contains errors, but it's 2:20am so I claim no responsibility whatsoever. ;-)
Feel free to ask for clarification on any points that are confusing... admittedly, this is a poor overview of the vast subject of 3d view transformations, which deserves 20 pages of text rather than 2. In a large-scale 3d game - or one involving complex cameras and/or cameras floating in free space (with no discernible "up" or "down") - there are actually much better ways of treating angles than with yaw/pitch/roll (called Euler angles), namely Quaternions and Matricies.
cheers,
-sq
p.s. Come to think of it, things might not be all that bad using gluLookAt() after all. We'd basically just have a 3d "forward" vector for the player (which we'd update whenever yaw-ing or pitch-ing occurred) and then set a view target at an arbitrary remote point along that vector. However, it's still probably conceptually simpler to think in terms of Euler angles for the time being.
| 11.15.2002 at 06:06PM PST, ID: 7456111 |
| 11.20.2002 at 05:36PM PST, ID: 7476164 |
| 10.01.2003 at 12:17AM PDT, ID: 9464521 |