reckfellENGINE

Bone2D

A bone in a 2D skeleton hierarchy.

On this page
class Bone2DReckfellSharpInherits Entity2D

Bone2D defines a joint transform and its saved local Rest pose. Its parent must be another Bone2D or Skeleton2D: an intermediate Entity2D breaks bone registration.

Child images can move as rigid parts. Deforming one Polygon2D also requires vertex weights and a skeleton assignment. SetLength() alone does not stretch an image or polygon.

Working example.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

Bone2DConstructor
# Bone2D
C#
public Bone2D();

Properties1

RestProperty
# Rest
C#
public Transform2D Rest { get; set; }

The saved transform relative to the parent bone or Skeleton2D, not a world pose. Assignment changes the skinning rest pose; call ApplyRest() to move the current bone to it.

Methods11

ApplyRestvoid
# ApplyRest
C#
public void ApplyRest();

Copies Rest into this bone's local Transform. It does not traverse child bones or disable animation or IK; another pose writer can overwrite the result.

GetAutocalculateLengthAndAnglebool
# GetAutocalculateLengthAndAngle
C#
public bool GetAutocalculateLengthAndAngle();

Returns whether this Bone2D is going to autocalculate its length and bone angle using its first Bone2D child node, if one exists. If there are no Bone2D children, then it cannot autocalculate these values and will print a warning.

Returns bool
GetBoneAnglefloat
# GetBoneAngle
C#
public float GetBoneAngle();

Returns the angle of the bone in the Bone2D. Note: This is different from the Bone2D's rotation. The bone's angle is the rotation of the bone shown by the gizmo, which is unaffected by the Bone2D's Entity2D.Transform.

Returns float
GetIndexInSkeletonint
# GetIndexInSkeleton
C#
public int GetIndexInSkeleton();

Returns the index in the current skeleton after updating bone setup. Without a registered Skeleton2D it reports an error and returns -1. The index can change when the hierarchy is rebuilt.

Returns int
GetLengthfloat
# GetLength
C#
public float GetLength();

Returns the length of the bone in the Bone2D node.

Returns float
GetRestTransform2D
# GetRest
C#
public Transform2D GetRest();
Returns Transform2D
GetSkeletonRestTransform2D
# GetSkeletonRest
C#
public Transform2D GetSkeletonRest();

Returns the rest transform in skeleton coordinates by multiplying local Rest transforms along the parent-bone chain. It is not the current animated GlobalTransform.

Returns Transform2D
SetAutocalculateLengthAndAnglevoid
# SetAutocalculateLengthAndAngle
C#
public void SetAutocalculateLengthAndAngle(bool autoCalculate);

When set to true, the Bone2D node will attempt to automatically calculate the bone angle and length using the first child Bone2D node, if one exists. If none exist, the Bone2D cannot automatically calculate these values and will print a warning.

Parameters
NameTypeDefault
autoCalculatebool—
SetBoneAnglevoid
# SetBoneAngle
C#
public void SetBoneAngle(float angle);

Sets the bone angle for the Bone2D. This is typically set to the rotation from the Bone2D to a child Bone2D node. Note: This is different from the Bone2D's rotation. The bone's angle is the rotation of the bone shown by the gizmo, which is unaffected by the Bone2D's Entity2D.Transform.

Parameters
NameTypeDefault
anglefloat—
SetLengthvoid
# SetLength
C#
public void SetLength(float length);

Sets the length used by the bone representation and solvers. Disable automatic calculation with SetAutocalculateLengthAndAngle(false) for manual control. Length alone neither changes Polygon2D vertices nor stretches a child sprite.

Parameters
NameTypeDefault
lengthfloat—
SetRestvoid
# SetRest
C#
public void SetRest(Transform2D rest);
Parameters
NameTypeDefault
restTransform2D—
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.