Hi,
Can someone explain what's wrong with the following code. I'm trying
to set the value of the Z Rotation in the lMetatarsals bone in a G3F figure.
In the example below, I want to set it to 2.0 but it always ends up as 5.0.
Now I've realized that the lMetatarsals are controlled by the lToe bone,
so when the lToe twists, the lMetatarsals twists by the same amount. But I
can manually adjust the Z Rotate dial of the lMetatarsals to any value I
want. So does the method 'setValue()' do exactly the same as adjusting the
dial manually? It doesn't look like it. How can I set the rotation value to
the value I want, in a script? Or do I have to somehow unlink the 2 bones?
(function(){ var lToeValue, lMetaValue, lMetaBone, lToeBone, lMetaCtrl, lToeCtrl; var fig = Scene.getPrimarySelection().getSkeleton(); lMetaBone = fig.findBone("lMetatarsals"); lToeBone = fig.findBone("lToe"); lMetaCtrl = lMetaBone.getZRotControl(); lToeCtrl = lToeBone.getZRotControl(); lMetaValue = lMetaCtrl.getValue(); lToeValue = lToeCtrl.getValue(); print("Values Before: " + "lMetatarsals = " + lMetaValue + ", " + "lToe = " + lToeValue); lToeCtrl.setValue(3.0); lMetaCtrl.setValue(2.0); lToeValue = lToeCtrl.getValue(); lMetaValue = lMetaCtrl.getValue(); print("Values After: " + "lMetatarsals = " + lMetaValue + ", " + "lToe = " + lToeValue); })();
// Output:
// Values Before: lMetatarsals = 0, lToe = 0
// Values After: lMetatarsals = 5, lToe = 3