[Closed] Attachment Controller Orientation
If you attach an object to a mesh using the attachment controller and check on Align To Surface and then move the object around the surface the orientation of the object pops all over the place. I am trying to find a way to orient the object down its Y axis relative to the Z or normal of the surface. This appears to be easier said then done as I try to rotate the object back to where it should be I just can’t get control over it.
I have tried applying the rotation part back and also trying to just rotate the Z and can’t get a proper result.
Any one tried to do this and found a solution to it. It is a bit strange as a position controller is affecting the orientation of an object.
Thanks for any help you can.
as i remember when the align to surface mode is ON, the controller aligns the node this way:
X is oriented as first edge of the face the node attached to
Z is as face normal
Y is cross product X and Z
so if know the face you can get the rotation of the node.
the rotation controller of the node is not locked. it just becomes additive to the value after alignment.
I don’t know what is going on then. I can get the orientation right generated but when I move it and access the key and try to reset the orientation the same transform math just makes a mess of it. I will see if I can put a simple test together on Tuesday.
Final got back to this. What I get is this.
-y is pointing at edge 3
z is normal and
x is cross of y z
So here is what I’m trying to refine. I stick a node to one side of a mesh and I want to have a node on the mirror side also stuck to the surface. That isn’t to bad if I don’t try and offset them.
If I want a very specific orientation and try and set it through a matrix or quat I get all sorts of issues. I have also realized that trying to type the values into the type in transform doesn’t work either in any way. Change the X and it changes the Y and Z for you. If you do this through Max Script it is fine but trying to mirror the orientation via eulers is not really possible since even 0,0,0 on both doesn’t get me an exact mirror much of the time.
So can any one show me a method that will work all the time?
definitely it reminds me something… i bet that you want to use it for a new rig idea.
well… of course the eulers will not work for symmetry. you have to use mirror matrices. which are:
(no max around so i will try to use my garret)
#x: (matrix3 [-1,0,0] [0,1,0] [0,0,1] [0,0,0])
#y: (matrix3 [1,0,0] [0,-1,0] [0,0,1] [0,0,0])
#z: (matrix3 [1,0,0] [0,1,0] [0,0,-1] [0,0,0])
the problem is… the rotation is partly controlled by attach constraint. so probably (it’s just an idea) we can organize a rotation_list where the second channel could be used for an ‘our-need-correction’
what do you mean? is Y pointing at center of edge 3? or Y has the same as edge 3 direction?
also… are we talking about mesh or poly attached to surface?
Finally got something but it is not what I would expect at all.
$AttachedPoint.rotation=(quat 0 0 0 1)
$AttachedPoint.transform= $target.transform*inverse $AttachedPoint.transform
The solution needs to have the rotation set to 0 first then multiply the target transform by that of the inversed attachment and apply that to the attachment.
Just doesn’t feel right but it works. Has to be a more correct solution.
I’d suggest to not use the Align to Surface option at all and create your own orientation from scratch. Maybe something like a target and upnode would work. A copy of the surface with a push modifier on it and an extra node with an instanced attachment controller on it might work as a target and upnode.
Interesting idea Grack. I think that would really start to slow the rig down as there would be two attachments and you would need to access a vert to get the up vector.
The orientation of the attachment works fine, it is ensuring the the rig is mirrored and you have all the points in the correct orientation. In the past I have opted for a child to the point on the surface that is orientated correctly. I just don’t what to do that anymore.
The solution that I posted works but it seems odd and having to be done in the wrong space to make it work. It works perfectly, just doesn’t look right.
Denis, I posted my solution yesterday and your comments were not there, now it is before mine, very odd. As you can see I’m setting using a matrix and I mirror using the good old fashioned matrix manipulations
check what i have for the face constraint. it’s max 2012 file.
point uses attachment position controller, and lookat constraint to dummy with surface as UpNode.
dummy’s position is a rotation list with two rotation controllers wired to surface points (1 and 2) fifty-fifty
Nice, still not quite what I was looking at doing.
-y is pointing at the third edge in my test on a simple triangle and stays pointing at it when the verts are moved on the face. If you move vert 1 the attached point doesn’t rotate, only when verts 2 and 3 are moved does it change the rotation of the point.
What I was looking at doing is not controlling the rotation of the point on the surface with wires or other controllers, I’m aware that can be done. I wanted to be able to set, with out error the rotation of the point on the surface using Max script when the point had align to face turned on. It ends up in some strange space. I have had to keep moving again but what I posted works, just doesn’t look right still to me. I don’t like the idea of having to reset the point to 0 in rotation before rotating it to where I want. Just being picky is all.
i’ve played with attachment controller a lot trying to use it in my rigs. honestly saying… with no any success.
something blocks me. there is a similar technique in Maya, and it works well. but in the max i couldn’t replicate it.