# Thread: should i convert my camera to quaternions?

1. ## should i convert my camera to quaternions?

i just have a regular camera class
and i cant seem to get any correct camera angles between the world and camera view besides the z axis which is my rotation angle from left to right

2. ## Re: should i convert my camera to quaternions?

i just have a regular camera class
What is a "regular camera class," and how does it differ from other camera classes that we may have used that are not "regular?"

Or you could just explain how your camera class works.

3. ## Re: should i convert my camera to quaternions?

see how this is only using a simple sin and stuff
it makes getting angles very hard
and i even read that is not reliable either

void RotateView(float speed) {

camera.view[1] = (float)(camera.pos[1] + sin(speed) * camera.vector[0] + cos(speed) * camera.vector[1]);
camera.view[0] = (float)(camera.pos[0] + cos(speed) * camera.vector[0] - sin(speed) * camera.vector[1]);

}

4. ## Re: should i convert my camera to quaternions?

You also need to explain what it is you want the camera to actually do that you're having trouble with.

And USE PUNCTUATION! Periods, sentences, paragraphs. Maybe the reason you don't have a lot of "views" is because it's hard to read what you're writing.

5. ## Re: should i convert my camera to quaternions?

you know that was totally a runon sentence?

but overlooking that unintentional mishap. i believe i have already expressed the issues i am having with my camera class, which are: that i am unable to easily calculate the x rotation angle which keeps flipping values, as i can the z rotation angle that doesnt;

6. ## Re: should i convert my camera to quaternions?

that i am unable to easily calculate the x rotation angle which keeps flipping values, as i can the z rotation angle that doesnt;
What do you mean by "the x rotation angle"? What space are you trying to rotate about the X axis? And what exactly are you rotating: the camera's position, the camera's view target, or something else entirely?

How exactly are you trying to control the camera's position and orientation? That's the part I don't understand. You posted a few lines of code that compute two components of "camera.view", but you don't explain what "camera.view" is or how it gets used. Are these values passed to gluLookAt? Are they used by your own matrix generation code?

7. ## Re: should i convert my camera to quaternions?

im trying to get the look up and down angle so i can transform models with it on the models x axis

8. ## Re: should i convert my camera to quaternions?

im trying to get the look up and down angle so i can transform models with it on the models x axis
I still don't understand what you're doing here. I understand that you want to make the camera look up and down, but I don't see why you're wanting to rotate about the model's X axis to do this. Shouldn't that be the world's X axis if you're dealing with the camera? Is there a world space at all in your series of transforms?

Also, you didn't explain what "camera.view" is.

In any case, it seems clear that what you have is a typical "Orientations, not rotations" problem. Successive transformations are applied successively. So if you have a Z rotationorientation followed by an X rotationorientation, the X orientation will be relative to the coordinate system after the Z orientation transform. That is, the X axis being oriented around is not relative to the original X axis, but relative to the X axis in the coordinate system after the Z orientation.

9. ## Re: should i convert my camera to quaternions?

there is a camera.pos and a camera.view
those are the two coordinates that make the camera vector
and with a mouse i can rotate the camera using gllookat()
but i cant rotate a model the same way i rotate the camera
because the model only has glrotate not lookat
so thats why i need the angles

10. ## Re: should i convert my camera to quaternions?

but i cant rotate a model the same way i rotate the camera
because the model only has glrotate not lookat
so thats why i need the angles
OK, so you're trying to rotate a model, not the camera. I linked you to a multi-page dissertation on how to orient models. Was something on that page unclear?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•