Is there an equation to derive alternative rotation values?

Is there an equation to derive alternative rotation values?

mcw0
Advisor Advisor
887 Views
5 Replies
Message 1 of 6

Is there an equation to derive alternative rotation values?

mcw0
Advisor
Advisor

Sorry, I tried to do tag multiple categories but it didn't work.  So I'm posting this here as well as in the Animation and Rigging section.  Sorry if this is a no-no.

 

Have you ever used an orientConstraint and Maya always defaults to "Average" for the interpType.  But switching it to "Shortest" gives you completely different rotation values that are also valid.  What is the equation for calculating these alternative values?

0 Likes
888 Views
5 Replies
Replies (5)
Message 2 of 6

jmreinhart
Advisor
Advisor

https://download.autodesk.com/us/maya/2011help/API/class_m_euler_rotation.html#e1fdb2bb991d9c834f851...

 

There is the alternateSolution method on the MEulerRotation class. 

 

The actual  internal math is a rabbit hole you probably don't need to go down.

https://www.gregslabaugh.net/publications/euler.pdf

 

0 Likes
Message 3 of 6

mcw0
Advisor
Advisor

Thanks for those links.  I'll check it out.  I have this same post in the Animation and Rigging section.  And I came up with a workaround that doesn't require getting into the API.  I usually shy away from plugin type solutions just because of the maintenance aspect of plugins.

 

The following is copied and pasted from my other post:

 

I still don't know the equation to figure this out mathematically.   But I did come up with a work-around.  I'm dealing with mocap on a character.  Since most character rigs are mirrored with behavior, this automatically sets the joint orient values to make this possible.  Mocap rigs do not.  Joint orient on mocap joints are all 0 0 0.  So when you orient constrain something, usually on the right side, you get crazy values for rotation.  And if you want to blend keyframes with mocap, this is a real nightmare.

 

My workaround is to duplicate the joint in question and zero out the rotation.  Then create a rotatePlane ikHandle.  I also parent locators to the corresponding mocap joint and to my duplicated joint with a 1 unit offset on 1 of the axis.   This is to measure my twist angle.  I snap the ikHandle to the mocap joint and measure my twist angle.  And that gets me rotation values I can use.  Then I delete my duplicated joints and locators.  Clunky but once scripted, it just works.

0 Likes
Message 4 of 6

jmreinhart
Advisor
Advisor

Api doesn't necessarily mean plugin. If you're using the python api you can use it just like cmds. 

i'm glad you found a solution though

0 Likes
Message 5 of 6

mcw0
Advisor
Advisor

You're 100% correct about the python API.  I really should tear myself away from MEL.  Thanks

0 Likes
Message 6 of 6

olarn
Advocate
Advocate

I think the alternative ones is supposed to be shortest/longest slerp path between targets, and an "Average" mode that also tracks previous result to avoid flipping. The default setting is quaternion average.

https://help.autodesk.com/cloudhelp/2020/ENU/Maya-Tech-Docs/Nodes/orientConstraint.html

0 Likes