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/f8c2c1ec-c060-4c6f-a5c6-37f1aea368e3%40googlegroups.com.

Reply via email to