Notifications
Clear all

[Closed] QuatToEuler Quandry

Greetings…

Another day, another hair puller… I’m at a bit of a loss as to why Y rotation conversions are returning unexpected results…

In the attached file (Max 2010) each of the 3 boxes rotates around a different local axis with the same keyframe animation. Each box also has a testVal CA which evaluates the following line for the apropriate axis of rotation. (where source is the object itself)

(quattoeuler source.transform.rotationpart).z_rotation

X, and Z rotation work fine, but Y returns a different curve. I have tried adding and then chaning order:[1-9] to the quatToEuler function, and tried to invert the quat value before conversion, but have not been able to find a way to get correct Y rotation values directly from the transform. To be honest Quat values are a bit over my head so I was just blindly using trial and error.

Any ideas?

Cheers

Mikie

4 Replies

Have you read through this post and the thread it links to? Use:

(QuatToEuler2 (inverse source.rotation)).<axis>_rotation

and it will return the exact same curve for all. QuatToEuler2 is a different algorithm that returns the same results as the UI, and appears to resolve your issue.

-Eric

Thanks for that, It works for direct animation, but sadly doesn’t cover all cases (which I probably should have made clear from the outset)

The reason I think I have no option but to interrogate the transform matrix itself is becasue in my case the rotation can be inhertited in many different ways… Rotation resulting from path constraint following for instance, wouldn’t show up when using .rotation values.

The link you provided was quite intersting tho… I’m wondering if this is an inherant property of the ‘right handed’ calcs internal to 3ds max… Though I need to read a wiki or two to find out what that really means.

Mikie

Then just swap to:

(quattoeuler2 source.transform.rotationpart).y_rotation

Which appears to work for this file. Can’t speak about other ones.

-Eric

Thanks so much! I swear I tried that, but must have been mucking about with inverting the quat and playing with the order at the same time…

There is a very large matrix shaped hole in my math skills I really need to fill… As trying to figure this stuff out by trail and error just sucks…