# SFSpoto

Member

6

122 Neutral

• Rank
Newbie
1. ## Implementing camera changing projection matrix

Ah ok, i undestand.
2. ## Implementing camera changing projection matrix

Hi people. I know that the common way to implement camera in 3d games/world is simulating his movement by updating the object in the world of the inverse of camera movement/rotation. Is it possible implementing camera changing the projection plane (and so the projection matrix)? Yes, i think. This way has additional computational cost? The cost is equivalent? I think that the computational cost may be cheaper. The disvantage is that is a less intuitive way. What do you think about this? Hi. [EDIT] mmmm....i think that the computational cost is equivalent [Edited by - SFSpoto on October 29, 2005 8:02:51 AM]
3. ## OpenGL Help picking

Hi. I have studied the opengl system for pick an object in 3d space. It is collegated to the name stack of objects. For example, if i wont to get a single vertex of a mesh, i must to save a name on stack for each vertex? If there is a complex mesh, or several different complex meshes, this system is not too expesive? What is the system that is used in this case? tnx.
4. ## Quaternion rotation

hei tnx, i have corrected that and traslation now seem to work well BUT...this kind of camera can suffers of gimbal lock or something similar? The camera work well for a lot but when i see the object from backward the rotation on the x axis became a rool. Why? Tnx.
5. ## Quaternion rotation

Hi to all. I compute three rotation quaternions and then multiply them for obtain a TOTAL rotation matrix. In this way: // create quaternion for rotation around y axis qYaw.CreateRotationQuaternion(0.0f, 1.0f, 0.0f,yawDegree); // create quaternion for rotation around x axis qPitch.CreateRotationQuaternion(1.0f, 0.0f, 0.0f, pitchDegree); // create quaternion for rotation around z axis qRoll.CreateRotationQuaternion(0.0f, 0.0f, 1.0f, rollDegree); // then i multiply them for obtain total rotation quaternion q = qRoll * qYaw * qPitch; q.CreateQuaternionMatrix(rMatrix); glMultMatrixf(rMatrix); // now after glMultMatrixf(rMatrix); // the rotation seem to work well. // But then i extract view vector form rMatrix in this way: viewVect.x = Matrix[2]; viewVect.y = Matrix[6]; viewVect.z = Matrix[10]; posVect.x +=viewVect.x; posVect.y +=viewVect.y; posVect.z +=viewVect.z; // then i traslate glTranslatef(-posVect.x, -posVect.y, posVect.z); // BUT the traslation seem to be bloked on a certain axis I think that is not the look vector thet i get from rotation matrix. How can i get the look vect at this point? Tnx very much.
6. ## Beginner camera problem

Hi to all. This is my first post:) I have defined three function that calculate the rotation around the x axis, the y axis and traslation. Then i use this functions to compute the parameters to paste to glulookat. No problem with traslation, but when i use the two rotation simultaneously the camera doesn't work fine. In fact it rotate olny arount the y axis. But when i use only one rotation it works fine. Why? Tnx to all. There are the functions: // translate camera void MoveCamera ( FVector3D Direction ) { Position = Position + Direction; } // rotate around x void RotateCameraX ( GLfloat Angle ) { RotatedX += Angle; //Rotate viewdir around the right vector: ViewDir = (ViewDir*cos(Angle*PIdiv180) +UpVector*sin(Angle*PIdiv180)).NormalizeFVector3D(); //now compute the new UpVector (by cross product) UpVector = (ViewDir^RightVector)*-1; } // rotate camera around y void RotateCameraY ( GLfloat Angle ) { RotatedY += Angle; //Rotate viewdir around the up vector: ViewDir = (ViewDir*cos(Angle*PIdiv180) - RightVector*sin(Angle*PIdiv180) ).NormalizeFVector3D(); //now compute the new RightVector (by cross product) RightVector = ViewDir ^ UpVector; }