Stores the current pose for an IK constraint. An IK constraint adjusts the rotation of 1 or 2 constrained bones so the tip of the last bone is as close to the target bone as possible.

See IK constraints in the Spine User Guide.

Constructor

new(data:IkConstraintData, skeleton:Skeleton)

Variables

@:value(false)active:Bool = false

@:value(0)bendDirection:Int = 0

Controls the bend direction of the IK bones, either 1 or -1.

bones:Array<Bone>

The bones that will be modified by this IK constraint.

@:value(false)compress:Bool = false

When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it.

data:IkConstraintData

The IK constraint's setup pose data.

@:value(1.0)mix:Float = 1.0

A percentage (0-1) that controls the mix between the constrained and unconstrained rotations.

@:value(0.0)softness:Float = 0.0

For two bone IK, the distance from the maximum reach of the bones that rotation will slow.

@:value(false)stretch:Bool = false

When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained and the parent bone has local nonuniform scale, stretch is not applied.

target:Bone

The bone that is the IK target.

Methods

apply():Void

Applies the constraint to the constrained bones.

apply1(bone:Bone, targetX:Float, targetY:Float, compress:Bool, stretch:Bool, uniform:Bool, alpha:Float):Void

Applies 1 bone IK. The target is specified in the world coordinate system.

apply2(parent:Bone, child:Bone, targetX:Float, targetY:Float, bendDir:Int, stretch:Bool, softness:Float, alpha:Float):Void

Applies 2 bone IK. The target is specified in the world coordinate system.

Parameters:

child

A direct descendant of the parent bone.

isActive():Bool

update():Void