Away3D FaceLink

Flash

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.

AwayFaceLink2

The code is very easy to implement:
import away3d.animators.FaceLink;
[..code..]
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.
facelink.update();

On moving item or geometry change like for animated md2, pass a boolean :true
facelink.update(true);

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

AwayFaceLink1

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.

Away3D 2.3 is out!

News

Away3D RULES!

I’m very proud to announce that Away3D 2.3 is officially released!

Rob, Katopz, Li, Pete, Greg, Richard, Stuart, Andreas, Nathaniel
Thank you all!

Fabrice

Away3D Smooth transitions

Flash

normalmaps1

This is something I wanted add to Away for quite a while now and I’m pretty sure animators and game makers will be pleased with this one: Be able to have smooth transitions between actual playing animation state and the next one while still playing own smooth animation.
The engine was already able to interpolate smoothly between keyframes of an animation, but when a new animation was started, if the animator did not provide any logical keyframes to start the next one, the result was a sort of hard cut between sequences. Even with the addition of smart keyframes, there was allways a gap. Not anymore!

This little demo illustrates the differences. Just clik on the objects to toggle the animations and be able to see the transitions at work.Watch movie online The Transporter Refueled (2015)

This behavior is now standard to the engine, and can be updated at runtime.
It works for all the supported mesh animations of the engine: md2, AS3 animated exports and the Animator class. It will be automatically triggered when a new animationSequence is started.

The standard transition duration is set to 10. Witch means that during the next 10 render sessions, the animation will be interpolated using its own animation information and will gradually get 1/10 less information of the last state of the previous animation.

To change it runtime it’s easy (like most Away code):
(myanim as Mesh).transitionValue = 20;
This value for instance would, depending on swf playrate, display a very smooth transition.
Ideal for changes between logical states such as “sit” to “stand”.
For transitions that should go faster, like “jump”, just set the value lower.

To keep the previous engine behavior, set it to 1 witch is the lowest value possible.
(myanim as Mesh).transitionValue = 1;

You do not need to set it per enterframes unless you want to. You can set it just once if you want another value than the default 10 or set it runtime on animation changes to get most logical movements between your animation sequences. If you are pleased with the default value: do nothing!