Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

SkeletonIK3D

Deprecated: This class may be changed or removed in future versions.

Inherits: Node < Object

A node used to rotate all bones of a Skeleton3D bone chain a way that places the end bone at a desired 3D position.

Description

SkeletonIK3D is used to rotate all bones of a Skeleton3D bone chain a way that places the end bone at a desired 3D position. A typical scenario for IK in games is to place a character's feet on the ground or a character's hands on a currently held object. SkeletonIK uses FabrikInverseKinematic internally to solve the bone chain and applies the results to the Skeleton3D bones_global_pose_override property for all affected bones in the chain. If fully applied, this overwrites any bone transform from Animations or bone custom poses set by users. The applied amount can be controlled with the interpolation property.

# Apply IK effect automatically on every new frame (not the current)
skeleton_ik_node.start()

# Apply IK effect only on the current frame
skeleton_ik_node.start(true)

# Stop IK effect and reset bones_global_pose_override on Skeleton
skeleton_ik_node.stop()

# Apply full IK effect
skeleton_ik_node.set_interpolation(1.0)

# Apply half IK effect
skeleton_ik_node.set_interpolation(0.5)

# Apply zero IK effect (a value at or below 0.01 also removes bones_global_pose_override on Skeleton)
skeleton_ik_node.set_interpolation(0.0)

Tutorials

Properties

float

interpolation

1.0

Vector3

magnet

Vector3(0, 0, 0)

int

max_iterations

10

float

min_distance

0.01

bool

override_tip_basis

true

StringName

root_bone

&""

Transform3D

target

Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

NodePath

target_node

NodePath("")

StringName

tip_bone

&""

bool

use_magnet

false

Methods

Skeleton3D

get_parent_skeleton() const

bool

is_running()

void

start(one_time: bool = false)

void

stop()


Property Descriptions

float interpolation = 1.0

  • void set_interpolation(value: float)

  • float get_interpolation()

Interpolation value for how much the IK results are applied to the current skeleton bone chain. A value of 1.0 will overwrite all skeleton bone transforms completely while a value of 0.0 will visually disable the SkeletonIK. A value at or below 0.01 also calls Skeleton3D.clear_bones_global_pose_override.


Vector3 magnet = Vector3(0, 0, 0)

  • void set_magnet_position(value: Vector3)

  • Vector3 get_magnet_position()

Secondary target position (first is target property or target_node) for the IK chain. Use magnet position (pole target) to control the bending of the IK chain. Only works if the bone chain has more than 2 bones. The middle chain bone position will be linearly interpolated with the magnet position.


int max_iterations = 10

  • void set_max_iterations(value: int)

  • int get_max_iterations()

Number of iteration loops used by the IK solver to produce more accurate (and elegant) bone chain results.


float min_distance = 0.01

  • void set_min_distance(value: float)

  • float get_min_distance()

The minimum distance between bone and goal target. If the distance is below this value, the IK solver stops further iterations.


bool override_tip_basis = true

  • void set_override_tip_basis(value: bool)

  • bool is_override_tip_basis()

If true overwrites the rotation of the tip bone with the rotation of the target (or target_node if defined).


StringName root_bone = &""

The name of the current root bone, the first bone in the IK chain.


Transform3D target = Transform3D(1, 0, 0, 0, 1, 0, 0, 0,