Attachment Controller Orientation


Hey, I’m still working on my little rigging tool but there is one thing I can’t wrap my head around.

I create some controllers (aPoint) on faces of an object (target) by selecting the faces.
Next I create an attachment from aPoint to the target with the previously selected face id.
Now I want to orient them all, let’s say z in normal direction of the face, y facing up, x facing to the rigth.

Without the attachment I can achieve it like this:


zV=(normalize(getFaceNormal target 190))
xV=normalize(cross yV zV)
yV=normalize(cross zV xV)

aPoint.transform=matrix3 xV yV zV aPointPos

With the attachment active I get weird results. I was checking the forum and found this post (wow my whole script idea is based on PEN’s tutorials and ideas xD):

The solution he gives there:

aPoint.rotation=(quat 0 0 0 1)
aPoint.transform= target.transform*inverse aPoint.transform

isn’t working for me plus I don’t realy understand why and where to put it in my script.

Maybe 7 years later someone has a solution for this.

Thanks in advance.


can you use an orientation constraint or a look at constraint ?


I don’t think so apparently


Did you ever find your solution?


when you say “up” and “right”, what coordinate system do you mean?


Apparently not. I have to focus on a project right now and don’t have the time to work on the script.


Ah, yeah sorry for the inaccuracy :sweat_smile:
I mean relative to the Z or normal of the surface.


one axis (Z in your case) is not enough to define the coordinate system. You have to specify at least to vectors