[4.1] Mesh Merge Alignment

Software: Away3D 4.x

Tempy111, Sr. Member
Posted: 25 September 2016 03:15 PM   Total Posts: 133   [ # 31 ]

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 /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..

 

   

Tempy111, Sr. Member
Posted: 27 September 2016 01:48 PM   Total Posts: 133   [ # 32 ]

Not finished, I want to clean up bits for a start, and i’m still fussing about a couple of parts of it but here is the current Facelink files. Includes ‘patched’ VertexAnimator.
usage is much the same as the old one with two extra variable passes, ‘OffsetDIR’, a vector3d which i’m trying to see about either removing (it was based on older code idea) or using for it’s original reason (I wanted it to help make a more global location.. a bit like a cross between align and target (so its facing a set direction at start, more then facing the direction related to the face.. if you know what I mean). and ‘Dot’. that’s a passing mesh value for debugging. So a mesh appears at the spot it’s looking at. that’ll probably either be removed for the final version or changed where it is in the list or something.. I’ll do a little bit of documentation when it’s all finished anyway.

I think there isn’t too much I can do about some faces just producing bad values… patching is kinda okay but won’t keep face direction of the mesh because it only has the one value to work with, not two..

 

File Attachments
FaceLink.as  (File Size: 15KB - Downloads: 306)
VertexAnimator.as  (File Size: 6KB - Downloads: 302)
   

Avatar
Fabrice Closier, Administrator
Posted: 27 September 2016 02:03 PM   Total Posts: 1265   [ # 33 ]

I’m sure many will value your effort! Please, if you have a moment, add some mini example on how to set it up, as many will likely have hard time use it otherwise..

 

   

Tempy111, Sr. Member
Posted: 27 September 2016 02:07 PM   Total Posts: 133   [ # 34 ]

it’ll have to wait to a bit later today but I want to do some documention, so that’ll include that ^_^ i’ll try to at least put an example useage which an be compiled and tested later today.

 

   

Tempy111, Sr. Member
Posted: 27 September 2016 04:59 PM   Total Posts: 133   [ # 35 ]

Quickly:

<Variable> = new FaceLink(Object to Link (Object3D),Mesh to link to (Mesh),Face Number(Number),<optional> Vector3D (unused-Vector3D),<optional>Mesh to show lookat point (Mesh), <optional>offset of Object (Number),<optional>align to Face (Boolean),<optional>Target to look at(Vector3D));

On Render of frames, run
<Variable>.updateLink(<optional>Update Normals(Boolean)>)

Example:
CharLink = new FaceLink(Hat, Char.meshes[0],1);

CharLink.updateLink(true);

I’ll try something more professional looking when I’ve finished the tweaking ^_^

 

   

Tempy111, Sr. Member
Posted: 28 October 2016 07:03 PM   Total Posts: 133   [ # 36 ]

Been a bit busy and.. well, some minor(ish) personal problems but i’m still working on this.. I think a couple of bits aren’t quite right but I hope to finish it off soon.. though I might need to take a bit of time purely on the testing side.. I do basic testing of course, but I need to give it a REALLY good test ^_^

Come to think of it.. i’m not quite sure WHAT I really want added or changed.. so I better get some basic things with it being used working and see what I need to get it to do ^_^

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X