well yes your right that is true on the one hand when I make the joint chain I do know the Z axis, however I am interrupting the automation of the script to allow the user to flip the joints if they want. At that point I loose the z axis information. this is a necessary aesthetic step if you want he polygons to fold down instead of up or vice versa. or if you want a mixture like an accordian fold. I could bake the z axis as a custom attribute on the joint, then when it flips the rotation I flip that attribute, but that seems a little messy, id rather call directly to the joint orientation.
It would be nice if I could separate the joint creation from the the binding, so in a sense I am trying to isolate the functions so they can be run independent from on another, because I might want the folding part of the script to run on other joint types say from a character or skeleton. Initially I get the rotation from a polygon edge for example so in this case I'd like to find it from just the joint, but since its already oriented properly with worldspace orientation I though all I would have to do is call the matrix to find it, but I don't think its working. I might try to make a local move on the joint in the Z axis to define the vector, so it would be something like. 1) get position of joint 2) move joint locally on the z axis 3) get new position of joint (then move back) 4) create vector from 2 point positions then your 4 steps 5) Find a mid point, M between joint 1 and joint 3. 6) Then get a vector from joint2 to M, maybe called OM 7) do a dot product of OM and the z-axis (or any other axis u define) . 8) If the dot product is more than 0, the it is the short angle, else take the long angle. On Monday, March 4, 2013 2:01:38 AM UTC-6, Jiet Shern Neo wrote: > I thought in your initial joint orientation phase, you have already orient > the joints in such a way it will rotate in a particular axis. since it is > defined, you should know which axis is pointint perpendicular to your > rotating axis? At laest, thats how i understand it. :) > > > Cheers, > JS Neo > > > > > On 4 March 2013 14:12, Bradon Webb <[email protected]> wrote: > > opp Jiet Shern Neo, actually I re-read your post this. I think I > misunderstood your step 3. I think your assuming that I know what the Z axis > is. even though I have it at one point to initially orient the joint, I > allow the user to flip the joint before the angles are calculated. I would > like it if this could work on any joint chains so maybe it is created from > another method where I don't have the z axis. > > > > > I guess I need a method to recalculate the Z axis on the joint? I tried the > matrix but I think I have some problems with that. > > > > > On Sunday, March 3, 2013 7:51:15 PM UTC-6, Jiet Shern Neo wrote: > > > Actually the way you resolve the joint orientation can be used to as a > > test. Example from your picture, we can see the z-axis always point in a > > certain direction defined by your joint orientation code. > > > > > > 1) Find a mid point, M between joint 1 and joint 3. > > > 2) Then get a vector from joint2 to M, maybe called OM > > > 3) do a dot product of OM and the z-axis (or any other axis u define) . > > > 4) If the dot product is more than 0, the it is the short angle, else take > > the long angle. > > > > > > > > > -- > > 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 [email protected]. > > To post to this group, send email to [email protected]. > > For more options, visit https://groups.google.com/groups/opt_out. -- 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 [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
