Header menu logo Nu

IkConstraint Type

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.

Constructors

Constructor Description

IkConstraint(data, skeleton)

Full Usage: IkConstraint(data, skeleton)

Parameters:
data : IkConstraintData
skeleton : Skeleton

IkConstraint(constraint, skeleton)

Full Usage: IkConstraint(constraint, skeleton)

Parameters:

Copy constructor.

constraint : IkConstraint
skeleton : Skeleton

Instance members

Instance member Description

this.Active

Full Usage: this.Active

Returns: bool
Modifiers: abstract
Returns: bool

this.BendDirection

Full Usage: this.BendDirection

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

this.Bones

Full Usage: this.Bones

Returns: ExposedList<Bone>

The bones that will be modified by this IK constraint.

Returns: ExposedList<Bone>

this.Compress

Full Usage: this.Compress

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

this.Data

Full Usage: this.Data

Returns: IkConstraintData

The IK constraint's setup pose data.

Returns: IkConstraintData

this.Mix

Full Usage: this.Mix

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.

this.SetToSetupPose

Full Usage: this.SetToSetupPose

this.Softness

Full Usage: this.Softness

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.

this.Stretch

Full Usage: this.Stretch

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 IkConstraint.Softness is > 0, and 3) if the parent bone has local nonuniform scale, stretch is not applied.

this.Target

Full Usage: this.Target

The bone that is the IK target.

this.ToString

Full Usage: this.ToString

Returns: string
Modifiers: abstract
Returns: string

this.Update

Full Usage: this.Update

Parameters:
Modifiers: abstract
physics : Physics

Static members

Static member Description

IkConstraint.Apply(bone, targetX, targetY, compress, stretch, uniform, alpha)

Full Usage: IkConstraint.Apply(bone, targetX, targetY, compress, stretch, uniform, alpha)

Parameters:
    bone : Bone
    targetX : float32
    targetY : float32
    compress : bool
    stretch : bool
    uniform : bool
    alpha : float32

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

bone : Bone
targetX : float32
targetY : float32
compress : bool
stretch : bool
uniform : bool
alpha : float32

IkConstraint.Apply(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha)

Full Usage: IkConstraint.Apply(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha)

Parameters:
    parent : Bone
    child : Bone - A direct descendant of the parent bone.
    targetX : float32
    targetY : float32
    bendDir : int
    stretch : bool
    uniform : bool
    softness : float32
    alpha : float32

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

parent : Bone
child : Bone

A direct descendant of the parent bone.

targetX : float32
targetY : float32
bendDir : int
stretch : bool
uniform : bool
softness : float32
alpha : float32

Type something to start searching.