Copy link to clipboard
Copied
Okay, so I'm trying to use the bone tool for it's IK so I can make a rope for my game. But for some reason it just refuses to work.... like almost at all. Here's a snippet of my code, I really just followed the Adobe sites tutorial here: http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS76E4A0A2-F3D9-43c8-BA07-A2B6D6DE5266.h...
public function init(e:Event):void
{
var tree:IKArmature = IKManager.getArmatureByName("Armature_18");
var bone:IKBone = tree.getBoneByName("ikBoneName74");
var endEffector:IKJoint = bone.tailJoint;
var pos:Point = endEffector.position;
ik = new IKMover(endEffector, pos);
ik.limitByDistance = true;
ik.distanceLimit = 10000000;
ik.limitByIteration = true;
ik.iterationLimit = 100;
this.addEventListener(Event.ENTER_FRAME, ropeUpdate);
}
public function ropeUpdate(e:Event)
{
// I have it spawn and attach to the player
var mat:Matrix = this.transform.matrix;
var pt = new Point(0, 0);
pt = mat.transformPoint(pt);
ik.moveTo(pt);
}
But instead of moving to whatever point I've set for it, it just sits in its default position and wiggles around a little bit when I move. I'm close enough for it to reach the point and it doesn't seem to be trying to reach a different point. So I'm really confused and I need help. Here are some screen shots of what it's doing:
The only time I think it might even be TRYING to reach the point is when I'm already almost on top of it but then it just moves upward when I do for no reason. It even does this when I'm even farther away from the point than when I was on the ground. I have no idea what I'm doing wrong and I'd greatly appreciate some help.
Have something to add?