If its all working, which it does seam like (though it kinda needs a bit more values passed to align then normal) the i’ll clean up the code an post that. the new FaceLink.as an the patch to the VertexAnimator (still want to tweak it a bit so I don’t need to add that). Still not quite sure on the NaN values on some faces.. but I don’t think that’s much to worry about
[Edit]
Something i’m not sure on.. when you press up in my demo (down to swap back), it’ll swap to a laying down animation which, the animation itself, is rotated about 90 degree.. I’ve update the swf to link to a face in the ear again for testing. It seams to work and rotated fine.. but on some faces, I think it fails to correctly rotate right.. i’m not quite sure..
[EDIT 2]
okay.. so for some reason, it doesn’t like some faces so the hat disappears.. but some faces it’s okay with, when the animation changed, it’s not okay with and it disappears.. I think more tweaking is needed… I just wonder how many are problems with the system (hey, sometimes there are going to be faces where the values come back can it doesn’t work) and how many are bugs with how I’m handing it…
[EDIT 3]
NaN values are created by the getTriangleNormal function getting vertexs whose sum ends up as 0.
this leads to the line:
var d:Number = 1 /Math.sqrt(cx*cx+cy*cy+cz*cz);
where cx, cy, and cz are 0.. d becomes infinity.. so then it does 0*infinity and returns NaN.
Quick dirty patch is to make the value in question a 0 if it detects the infinity. however, this screws up the movement so the hat doesn’t move and rotate correctly.. which is a pain when it turns out to be on a face which is kinda perfect for a certain location (like a perfect face in the head, or the hands)..
[Edit 4]
right.. found the issue is simple.. must be bad faces in the model.. 2 of the three vertex points have the SAME X,Y,Z values.. that’s not good at all.. very bad.. so I think I can ignore this problem.. apart from that fact that.. some faces are FINE with the standing animation but when swapped to another animation, it creates the problem.. which means.. it might NOT so much be the face being bad but possible that a face can get into an alignment/pose that means, for some reason, two vertices have the same value..