IkConstraint

spine.IkConstraint (Class)
Implements: Updatable

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.

Static Members

spine
applyOne(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.

Name Type
bone Bone
targetX Float
targetY Float
compress Bool
stretch Bool
uniform Bool
alpha Float

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

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

Name Type Description
parent Bone
child Bone A direct descendant of the parent bone.
targetX Float
targetY Float
bendDir Int
stretch Bool
uniform Bool
softness Float
alpha Float

Instance Members



spine
target: Bone

spine
bendDirection: Int

spine
compress: Bool

spine
stretch: Bool

spine
mix: Float

spine
softness: Float

spine
active: Bool

spine
update(): Void

Applies the constraint to the constrained bones.


The bones that will be modified by this IK constraint.

Returns
spine.support.utils.Array<Bone>

spine
getTarget(): Bone

The bone that is the IK target.

Returns
Bone

spine
setTarget(target: Bone): Void
Name Type
target Bone

spine
getMix(): Float

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

For two bone IK: if the parent bone has local nonuniform scale, the child bone's local Y translation is set to 0. | Returns | |---------| | [Float](/api-docs/clay-native/Float/) |


spine
setMix(mix: Float): Void
Name Type
mix Float

spine
getSoftness(): Float

For two bone IK, the target bone's distance from the maximum reach of the bones where rotation begins to slow. The bones will not straighten completely until the target is this far out of range.

Returns
Float

spine
setSoftness(softness: Float): Void
Name Type
softness Float

spine
getBendDirection(): Int

For two bone IK, controls the bend direction of the IK bones, either 1 or -1.

Returns
Int

spine
setBendDirection(bendDirection: Int): Void
Name Type
bendDirection Int

spine
getCompress(): Bool

For one bone IK, when true and the target is too close, the bone is scaled to reach it.

Returns
Bool

spine
setCompress(compress: Bool): Void
Name Type
compress Bool

spine
getStretch(): Bool

When true and the target is out of range, the parent bone is scaled to reach it.

For two bone IK: 1) the child bone's local Y translation is set to 0, 2) stretch is not applied if {@link #getSoftness()} is > 0, and 3) if the parent bone has local nonuniform scale, stretch is not applied. | Returns | |---------| | [Bool](/api-docs/clay-native/Bool/) |


spine
setStretch(stretch: Bool): Void
Name Type
stretch Bool

spine
isActive(): Bool
Returns
Bool

spine
getData(): IkConstraintData

The IK constraint's setup pose data.

Returns
IkConstraintData

spine
toString(): String
Returns
String

spine
new(data: IkConstraintData, skeleton: Skeleton): Void
Name Type
data IkConstraintData
skeleton Skeleton