1. ## 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. ## 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. ## Re: Rotating the axis?

identity every time.

So (in hypothetical C++):

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

4. ## 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. ## 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!

#### Posting Permissions

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