Sorry I can't run your code right now and I'm not exactly sure what results you're seeing.
If you're wondering why the non-uniform scale affects shear, it's because shear is exactly that - non-uniform scale on an axis other than one of the primary axes. Think about rotating a square 45° and then squashing it vertically. It ends up being a rhombus. If you're wondering why the shear causes the rotation to change, I'm not exactly sure how Maya reports rotation on transforms that have shear. In the imaginary square from my previous paragraph, the top and bottom edges have rotated by some angle, but the other two edges have rotated by a different angle (because the axes are not actually at right angles anymore, even though they look like they are in the Maya viewport). Does that help at all? If not, I can try to run the code tomorrow and see if I can give a more specific explanation. On Wednesday, 14 August 2019 12:40:06 UTC+10, vince touache wrote: > > Found a workaround, making my own orient constraints with matrices > instead, but I wouldn't mind some explanation on this, because I'm still > not sure why the scale has so much impact on an orient constraint > > Le mardi 13 août 2019 17:38:36 UTC-4, vince touache a écrit : >> >> Hi, >> >> I noticed a weird behavior when trying to scale a constraint object. >> My setup is made of 3 elements. One parent and its child, and a null, at >> the same level as parent. parent and null are aimConstraining the child (so >> the child will follow .5 each) >> parent >> |__ child >> null >> >> The weirdness happens when combining rotation and scale, which introduces >> some shear effect.. what I can't figure out though, is why this shear is >> affecting so much the rotation (my vectors are still visible as >> perpendicular). >> >> To check by yourself, you can run this snippet : >> >> parent = cmds.createNode('transform', ss=1) >> cube = cmds.polyCube()[0] >> cmds.parent(cube, parent, r=1) >> null = cmds.createNode('transform', ss=1) >> cmds.orientConstraint(parent, null, cube, mo=0) >> cmds.setAttr(parent + '.rx', 45) >> print 'before scale / shear', cmds.getAttr(cube + '.rx') >> cmds.setAttr(parent + '.sy', 2) >> print 'after scale / shear', cmds.getAttr(cube + '.rx') >> >> >> Before scaling, the rotateX of my cube is correct, but after, it's like >> 40-is degrees, which doesn't make much sense to me.... >> I have a shitty fix (run this code) >> # shittyFix >> dcm = cmds.createNode('decomposeMatrix', ss=1) >> cmds.connectAttr(cube + '.wm', dcm + '.inputMatrix') >> cpm = cmds.createNode('composeMatrix', ss=1) >> cmds.connectAttr(dcm + '.or', cpm + '.ir') >> cmds.connectAttr(dcm + '.os', cpm + '.is') >> cmds.connectAttr(dcm + '.ot', cpm + '.it') >> outDcm = cmds.createNode('decomposeMatrix', ss=1) >> cmds.connectAttr(cpm + '.outputMatrix', outDcm + '.inputMatrix') >> outLoc = cmds.spaceLocator()[0] >> cmds.connectAttr(outDcm + '.orx', outLoc + '.rx') >> print 'after shitty fix', cmds.getAttr(outLoc + '.rx') >> >> but it's still not perfect, and I'm not sur why... could this be due to >> some round issue ? That looks too much to me... >> Does anyone have an idea on how to get my proper pCube.rx = 22.5, with >> this setup (i.e. compensate the shear) ?? >> >> Thanks a lot ! >> >> >> -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/fab8e13e-9263-491b-8fbc-b876e888aff0%40googlegroups.com.