Results 1 to 2 of 2

Thread: Local Axis Rotation Problem

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2009
    Invercargill, Southland, New Zealand

    Local Axis Rotation Problem

    Hi. I have a 3d rotation problem that really shows up my lack
    of 3d knowledge lol. I'm trying to move a camera around using
    the arrow keys. Left-right arrow is supposed to rotate about
    local camera z axis, and up-down around local x-axis. But
    this code seems to rotate around the origin. Is it something
    to do with the order of operations?
    Any help greatly appreciated.

    //================================================== ===


    /// Load ship Position Matrix (camera)

    XFORM3D m;
    XForm3D_RotateZLocal(&m, Float_DegToRad(AngleZ));
    XForm3D_RotateXLocal(&m, Float_DegToRad(AngleX));
    XForm3D_SetTranslation(&m, Pos.x, Pos.y, Pos.z);
    glLoadMatrixf((GLfloat *)&m);


    //================================================== ===

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2009

    Re: Local Axis Rotation Problem

    It's difficult to say without knowing what is going on inside your XForm functions. At a guess I'd say you need to rotate the Pos.x/y/z values by the transpose(?) of the matrix you created in XFORM3D m.

Similar Threads

  1. How to rotate objects around global axis not local axis
    By silvermeteor in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 12-04-2017, 11:10 AM
  2. Problem with z axis rotation projected orthografically
    By hashbrown in forum OpenGL: General
    Replies: 6
    Last Post: 04-21-2017, 07:05 PM
  3. Problem of rotation with local axis
    By Thib02 in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 12-21-2009, 10:26 AM
  4. Local Axis Orientation Position & Rotation
    By ColacX in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-03-2009, 02:08 PM
  5. Local and global axis
    By Simon Hall in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-26-2000, 06:43 PM

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