Results 1 to 10 of 10

Thread: should i convert my camera to quaternions?

  1. #1
    Member Contributor
    Join Date
    Feb 2011
    Posts
    72

    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. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    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. #3
    Member Contributor
    Join Date
    Feb 2011
    Posts
    72

    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. #4
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    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. #5
    Member Contributor
    Join Date
    Feb 2011
    Posts
    72

    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. #6
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    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. #7
    Member Contributor
    Join Date
    Feb 2011
    Posts
    72

    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. #8
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    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. #9
    Member Contributor
    Join Date
    Feb 2011
    Posts
    72

    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. #10
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    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?

Similar Threads

  1. fps camera to quaternions upgrade code giveaway
    By enjoycrf in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-07-2011, 02:28 PM
  2. Camera & Quaternions
    By imported_beuleuppeup in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-15-2010, 01:59 PM
  3. Quaternions with a 6DOF camera?
    By mikeynovemberoscar in forum OpenGL: General
    Replies: 13
    Last Post: 02-15-2010, 03:16 AM
  4. Orbiting camera around a point using quaternions
    By mohammad_aburrub in forum OpenGL: Basic Coding
    Replies: 10
    Last Post: 10-24-2003, 09:47 PM
  5. Camera and quaternions
    By fcoutel in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 11-18-2002, 05:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean