This tutorial will teach you the basics to add bones to an object and move them using ActionScript 3.
It is quite simple, those are the steps to do:
- Design something ( to test i designed something like a snake
). - Click on the button Bone Tool (X).
- Draw a bunch of bones on the object making sure they are attached.
OK, now you should have something like this:
Make sure the last bone on the head is called: ikBoneName6As you can see in the TimeLine now you have a new layer called Armature_(Number), rename it to Armature_1 if it has another number.
Now click on the Armature_1 layer and you should see in the properties something like this:
Make sure to change the Type in Runtime.Now create an empty layer where to place the ActionScript on the TimeLine (to keep the tutorial short i placed everithing on the timeline).
import fl.ik.*;
var tree:IKArmature = IKManager.getArmatureByName("Armature_1");
var bone:IKBone = tree.getBoneByName("ikBoneName6");
// tailJoint will manage the point of your bone, if you want to manage the head of your bone you need to use headJoint
var tJ:IKJoint = bone.tailJoint;
var posT: Point=tJ.position;
var ikMover:IKMover = new IKMover(tJ, posT);
addEventListener(Event.ENTER_FRAME, onFrame);
function onFrame(event:Event){
posT.x=mouseX;
posT.y=mouseY;
ikMover.moveTo(posT);
}Now you are set, Test the movie and you should get something like this: