|
Flash CS4 Resources |
Instantiating an IK Mover and Limiting Its MovementAn instance of the IKMover class moves the axle. The following line instantiates the IKMover object ik,
passing to its constructor the element to move and the starting
point for the movement:
var ik:IKMover = new IKMover(endEffector, pos); The properties of the IKMover class let you limit the movement of an armature. You can limit movement based on the distance, iterations, and time of the movement. The following pairs of properties enforce these limits. The pairs consist of a Boolean indicating whether the movement is limited and a number that specifies the limit:
Set the appropriate Boolean property to true to enforce the limit. By default, all the Booleans are set to false, so movement is not limited unless you explicitly set them. If you set the limit to a value without setting its corresponding Boolean, the limit is ignored. In this case, the IK engine continues to move the object until another limit or the target position of the IKMover is reached. In the following example, the maximum distance of the armature
movement is set to 0.1 pixels per iteration. The maximum number
of iterations for every movement is set to ten.
ik.limitByDistance = true; ik.distanceLimit = 0.1; ik.limitByIteration = true; ik.iterationLimit = 10; |