Away3D FaceLink


AwayFaceLink1Logan live streaming movie

A new comer to the Away trunk is the FaceLink class. This one is also made for the
animators among the Away users. This handy little class allows you to link
objects to a face of a Mesh.
Think here the sword that must follow the leg of the moving avatar, the optional weapon your hero just won during battle… of course you can do totally different things with it as well, like the demo above. In this case a light and a model are coupled to a FaceLink instance. I’ve even been able to make some very funcky Ik chains with it.

The demo beneath shows an animated AS3 output being linked to a moving md2 model.


The code is very easy to implement:
import away3d.animators.FaceLink;
facelink = new FaceLink( item, mesh, mesh.faces[index], offset, align, target);

Lets say you have a gun, and you have prepared an avatar with a hand dedicated for this purpose. The code required when you want the model starts “wearing” the gun would then be: facelink = new FaceLink( gun, hero, hero.faces[index], 0, true);

Now the warrior you have made, has a gun thats opens from the leg
you code triggered the opening and you want the gun go outside the opening.
You just need to increase the offset. facelink.offset += myTweenValue;
The offset is calculated from face center, from there positive or negative values
will position the object along the normal vector of this face. You can change at runtime the face or any other properties of the class.

The align property triggers a lookat: the gun following a leg while its walking.
The last optional is another lookat. The gun would point at a specific coordinate.
That’s the gun pointing at the target.

Finally the engine needs to know if you want keep it alive, because you want be able to let the gun fall, or assign another weapon to the warrior.

Add just this line when the model position are updated, in case of static models.

On moving item or geometry change like for animated md2, pass a boolean :true

if you do not want the gun to be updated: don’t update, or pass another object to the class.


This little demo is also using the class, but is an excuse to show you the new added property for the BitmapMaterial: showNormals, which comes very handy to debug model geometry.