Results 1 to 5 of 5

Thread: Rotating the axis?

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    23

    Rotating the axis?

    Howdy

    I've got a problem that I'm pretty sure I've solved before but I can't work it out and I'm running out of hair to pull out. I've got something I want to rotate and then rotate again depending on user input. Which is fine and it works etc.

    I'm storing the rotation of the object as rotx,roty,rotz.

    The problem is that I want the axis to move with the object, if that makes sense. So it rotates as if its rotating from 0 each time. So that if rotx=90, rotating around y doesn't cause it just to spin.

    I really hope that makes sense. It's driving me nuts.

    Thanks.

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    23

    Re: Rotating the axis?

    And incase it matter I'm using my own rotation function instead of glRotatef because I need to keep track of the positions of things.

    Any ideas??

  3. #3
    Guest

    Re: Rotating the axis?

    When you create the rotation matrix just start with the
    identity every time.

    So (in hypothetical C++):

    Matrix m;
    m.loadIdentity();
    m.myRotate(rotx,roty,rotz);

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Dec 2007
    Posts
    1,077

    Re: Rotating the axis?

    Are you talking about having your own modelview matrix that is affected any frame while rotation?
    I can provide you with working code with which you can rotate the object about it's local axises even after a rotation.

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    23

    Re: Rotating the axis?

    Yup that sounds like it. I've got multiple objects that I want to be able to rotate around their own axis without that affect of them rotating around the "wrong" axis when they've already been rotated abit.

    I'd be interested in seeing any code or pseudo code you think will help.

    Thanks!

Similar Threads

  1. Rotating around a point and Rotating across own axis
    By Mighty in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-10-2004, 10:15 PM
  2. rotating and object without rotating its axis
    By scam in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 12-17-2003, 08:30 AM
  3. Rotating around z-axis
    By glcrazy in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-13-2003, 01:51 AM
  4. rotating the camera around y axis
    By GameMaker in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 11-11-2002, 06:17 PM
  5. rotating at the right axis
    By tbjerman in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-23-2001, 12:12 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