I was wondering if there is a simple way to control (i.e. retrieve the information and modify) the "local" axis of objects (namely joints). The problem is that the local axis is simulated. The command "rotate" gives the option to change the angle, but not to query for it.
Do you need to do it runtime or command time? In other words is it a parse of some kind or a node?
You realy dont gain anything form using api for this. Best use of maya api si not to use it. (sounds stupid but you can use the api indirectly form mel, which is more efficient in terms of productivity and no less fast)
Runtime. This is targeted to act as a manipulation node, and replace an existing expression which slows down the system. The calculations take translations and generate a new xform-based rotation.
Then you do this by connecting to the local axis attribute just liek your exprssion does. (you cannot use mfn in nodes externalities). LIkewise you NEVER use mel or python in expressions unless you have to and here you DONT. Thats should speed you up by about 10-100 times a node maybe 20-200 unless theres much to compute in the expression.
So if you use xform in a expression. Its not needed. Expression language is != mel
Use node reference (its the most important piece of maya documentation anyway, even the api section pales in comprrasion, even a api programmer needs to read it regulary). Anyway ist object.rotateAxis however rememer when you rotate the axis with xform it counter rotates the object by that amount*
*this essentially means thet if you roatate just the rotate axis object rotates if you want it NOT to rotate then you must make a EXTRA transform to dirve it if you need physical manipulation. Sine one attribute can only have one driving input.
It would stay still for a (rotation order of your node is forced to be of zyx as then its in the opposite order as local axis). Id never use a expression for this kind of stuff tough since i can use a multiplyDivide node as easily.
Thanks for the tip (node reference) I've got things messed up a bit, but I now know exactly what I want, but I think it creates a cycle: In the node, I want to calculate a new rotation but I need to base it on the previous rotation. Theoretically I would need to connect the rotation to my node, and connect the result AGAIN to the rotation.
This is obviously a loop, so how could that be resolved?
Describe more accurately what you need its easier to think that way.
But nothing stops maya form using cycles its just that may automaticcaly terminates them. BUt cycling results form based on previous frame are easy to do, if you need a iteration then you can allways precalculate it with a extra node.