rotatexyz HELP!!!!!!

een4djb@leeds.ac.uk's icon

hi everybody, i had posted this question earlier but it was very unclear, i now have a patch to illustrate my problem better

problem is explained in the patch

thanks

david

Max Patch
Copy patch and select New From Clipboard in Max.

Rob Ramirez's icon

well, the problem is opengl rotations are not really applied as euler (xyz) rotations, but as a quaternion. so the rotatexyz attribute is really just a helper for the rotate attribute (the quaternion rotation).

you can achieve what you want if you go in the proper order. set your rotation around z, then, y, and lastly x.

sorry i don't have a better explanation.

een4djb@leeds.ac.uk's icon

thanks for the reply, i think i understand the problem but not sure i understand the solution.
What object should i be using rotatexyz or just rotate (presumably rotate) and how do i go about setting them in order, i thought that you had to use pak and thus send them at the same time?

Is there any chance you could put it in a patch to help show me what you mean

Thijs Koerselman's icon

On Wed, Aug 20, 2008 at 7:42 PM, David Bradshaw wrote:

>
> thanks for the reply, i think i understand the problem but not sure i
> understand the solution.
> What object should i be using rotatexyz or just rotate (presumably rotate)
> and how do i go about setting them in order, i thought that you had to use
> pak and thus send them at the same time?
>
>
Hey David,

I'm not completely sure why the patch works like it does. I think it has to
do with the way rotatexyz is combining all of the rotations into one
command. The axis rotate correctly if you set the others to 0. So if you
rotate around y, it works if x and z are set to zero.

If x is not zero, it is applied first, then y. I think the problem is that
the object isn't rotated in object space but world space. The y is still
pointing up, even after the x rotation.

I know you can get what you're after if you just use opengl commands
separately. That's why I threw something together using sketch to draw your
object. Sketch is closer to plain opengl programming.

I advise you to put it in a javascript or something. Much cleaner and easier
to manage.

Cheers,
Thijs

Max Patch
Copy patch and select New From Clipboard in Max.

Thijs Koerselman's icon

On Wed, Aug 20, 2008 at 11:06 PM, Thijs Koerselman <
thijskoerselman@gmail.com> wrote:

>
> I know you can get what you're after if you just use opengl commands
> separately. That's why I threw something together using sketch to draw your
> object. Sketch is closer to plain opengl programming.
>
>
Oeps jumped to conclusions a bit too fast there. It's still the same
problem... I need to catch some sleep first. I'll give it another go
tomorrow it nobody beats me to it.

Cheers, Thijs

Thijs Koerselman's icon

On Wed, Aug 20, 2008 at 11:16 PM, Thijs Koerselman <
thijskoerselman@gmail.com> wrote:

>
>
> Oeps jumped to conclusions a bit too fast there. It's still the same
> problem... I need to catch some sleep first. I'll give it another go
> tomorrow it nobody beats me to it.
>
>
Nope, beats me. The problem is with the order in which the xyz rotation is
being applied. From what I could figure out it's correct, but not practical
for what you want to do.

I think you need to stick with a single angle-axis transformation. Maybe you
can use spherical coordinates with a radius of 1 (unit vector) to figure out
your axis. I don't know what input you have. Is it the wii? I'm shit at
maths, can you tell? ;)

There's a book in the lab called "essential mathematics for games". You
might want to check that out if you haven't found it already.

Good luck. Hope somebody else can be more of a help.

Cheers, Thijs

een4djb@leeds.ac.uk's icon

Hey thijs, how are you getting on?

Just got you reply now!

basically what i am trying to do is use the spacenav 3d mouse thing to navigate around (similar to amir) but i cant seem to map it correctly. I want to be able to control the rotations around the local axis so that i can achieve the mapping i want.

I found a load of externals converting eular to quat if that helps but they seem to still give the same problem...

cheers

david

Zachary Seldess's icon

It may not be what you're looking for, but I have several different versions of 3D navigators (using typical mouse and WASD control, and the Wii). Check out z.glNav2 - you should be able to modify it to whatever device you're using.

It's here: www.zacharyseldess.com/z.glNav.html

best,
Zachary

een4djb@leeds.ac.uk's icon

Thanks to everybody who replied, i have managed to achieve what i needed using a combination of positional changes and camera angle rotations

thanks again

david