Aligning a feather to a face in a mesh
I´m currently working on a script to automate the process of creating the controllers for a feather system. It´s based on the attachment controller.
I use a pflow to distribute the feathers. In the end, i have a bunch of single geometry feathers with their pivot point in the base of each. The Z Axis is paralel to the feather. I have found the baricentric coordinates and the correct face to feed the attachment constraint with and that works fine!
The problem is the feather changes orientation! When i tried to re-orient it by script, by storing the orientation in world coordinates and them aplying it later like feather.transform = oldTransform it just didn´t work!
But the odd thing is, when i try to align it by hand with the align tool in max, it just works!
Also, when i type: feather.rotation before and after the aplication of the attachment controller, it shows the same quaternion values, but if i use feather.transform.rotationpart the values are different!
So i have the idea to somehow extract the difference of the two angles and them apply it in reverse, but i can´t understand how to do it because of lack of matematical knoledge.
Any ideas? Thanks in advance!