Joint used with Skeleton2D to control and animate other nodes.
    public class Bone2D : Node2D

Use a hierarchy of Bone2D bound to a Skeleton2D to control, and animate other Node2D nodes.

You can use Bone2D and Skeleton2D nodes to animate 2D meshes created with the Polygon 2D UV editor.

Each bone has a Rest transform that you can reset to with ApplyRest(). These rest poses are relative to the bone’s parent.

If in the editor, you can set the rest pose of an entire skeleton using a menu option, from the code, you need to iterate over the bones to set their individual rest poses.

Inheritance Chain

Constructors

    public Bone2D()

Properties

    public float DefaultLength { get; set; }

Length of the bone’s representation drawn in the editor’s viewport in pixels.

    public Transform2D Rest { get; set; }

Rest transform of the bone. You can reset the node’s transforms to this value using ApplyRest().

Methods

    public void ApplyRest()

Stores the node’s current transforms in Rest.

    [Obsolete("GetDefaultLength is deprecated. Use the DefaultLength property instead.")]
    public float GetDefaultLength()

Getter for DefaultLength

    public int GetIndexInSkeleton()

Returns the node’s index as part of the entire skeleton. See Skeleton2D.

    [Obsolete("GetRest is deprecated. Use the Rest property instead.")]
    public Transform2D GetRest()

Getter for Rest

    public Transform2D GetSkeletonRest()

Returns the node’s Rest Transform2D if it doesn’t have a parent, or its rest pose relative to its parent.

    [Obsolete("SetDefaultLength is deprecated. Use the DefaultLength property instead.")]
    public void SetDefaultLength(float defaultLength)

Setter for DefaultLength

    [Obsolete("SetRest is deprecated. Use the Rest property instead.")]
    public void SetRest(Transform2D rest)

Setter for Rest

Tags: