Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

SkeletonModification2DTwoBoneIK

Inherits: SkeletonModification2D < Resource < RefCounted < Object

A modification that rotates two bones using the law of cosines to reach the target.

Description

This SkeletonModification2D uses an algorithm typically called TwoBoneIK. This algorithm works by leveraging the law of cosines and the lengths of the bones to figure out what rotation the bones currently have, and what rotation they need to make a complete triangle, where the first bone, the second bone, and the target form the three vertices of the triangle. Because the algorithm works by making a triangle, it can only operate on two bones.

TwoBoneIK is great for arms, legs, and really any joints that can be represented by just two bones that bend to reach a target. This solver is more lightweight than SkeletonModification2DFABRIK, but gives similar, natural looking results.

Properties

bool

flip_bend_direction

false

float

target_maximum_distance

0.0

float

target_minimum_distance

0.0

NodePath

target_nodepath

NodePath("")

Methods

NodePath

get_joint_one_bone2d_node ( ) const

int

get_joint_one_bone_idx ( ) const

NodePath

get_joint_two_bone2d_node ( ) const

int

get_joint_two_bone_idx ( ) const

void

set_joint_one_bone2d_node ( NodePath bone2d_node )