reckfellENGINE

SkeletonModification2DTwoBoneIK

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

On this page
class SkeletonModification2DTwoBoneIKReckfellSharpInherits SkeletonModification2D

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

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.

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

Constructors1

SkeletonModification2DTwoBoneIKConstructor
# SkeletonModification2DTwoBoneIK
C#
public SkeletonModification2DTwoBoneIK();

Properties4

FlipBendDirectionProperty
# FlipBendDirection
C#
public bool FlipBendDirection { get; set; }

If true, the bones in the modification will bend outward as opposed to inwards when contracting. If false, the bones will bend inwards when contracting.

TargetEntitypathProperty
# TargetEntitypath
C#
public EntityPath TargetEntitypath { get; set; }

The EntityPath to the node that is the target for the TwoBoneIK modification. This node is what the modification will use when bending the Bone2D nodes.

TargetMaximumDistanceProperty
# TargetMaximumDistance
C#
public float TargetMaximumDistance { get; set; }

The maximum distance the target can be at. If the target is farther than this distance, the modification will solve as if it's at this maximum distance. When set to 0, the modification will solve without distance constraints.

TargetMinimumDistanceProperty
# TargetMinimumDistance
C#
public float TargetMinimumDistance { get; set; }

The minimum distance the target can be at. If the target is closer than this distance, the modification will solve as if it's at this minimum distance. When set to 0, the modification will solve without distance constraints.

Methods16

GetFlipBendDirectionbool
# GetFlipBendDirection
C#
public bool GetFlipBendDirection();
Returns bool
GetJointOneBone2DEntityEntityPath
# GetJointOneBone2DEntity
C#
public EntityPath GetJointOneBone2DEntity();

Returns the Bone2D node that is being used as the first bone in the TwoBoneIK modification.

Returns EntityPath
GetJointOneBoneIdxint
# GetJointOneBoneIdx
C#
public int GetJointOneBoneIdx();

Returns the index of the Bone2D node that is being used as the first bone in the TwoBoneIK modification.

Returns int
GetJointTwoBone2DEntityEntityPath
# GetJointTwoBone2DEntity
C#
public EntityPath GetJointTwoBone2DEntity();

Returns the Bone2D node that is being used as the second bone in the TwoBoneIK modification.

Returns EntityPath
GetJointTwoBoneIdxint
# GetJointTwoBoneIdx
C#
public int GetJointTwoBoneIdx();

Returns the index of the Bone2D node that is being used as the second bone in the TwoBoneIK modification.

Returns int
GetTargetEntityEntityPath
# GetTargetEntity
C#
public EntityPath GetTargetEntity();
Returns EntityPath
GetTargetMaximumDistancefloat
# GetTargetMaximumDistance
C#
public float GetTargetMaximumDistance();
Returns float
GetTargetMinimumDistancefloat
# GetTargetMinimumDistance
C#
public float GetTargetMinimumDistance();
Returns float
SetFlipBendDirectionvoid
# SetFlipBendDirection
C#
public void SetFlipBendDirection(bool flipDirection);
Parameters
NameTypeDefault
flipDirectionbool—
SetJointOneBone2DEntityvoid
# SetJointOneBone2DEntity
C#
public void SetJointOneBone2DEntity(EntityPath bone2DEntity);

Sets the Bone2D node that is being used as the first bone in the TwoBoneIK modification.

Parameters
NameTypeDefault
bone2DEntityEntityPath—
SetJointOneBoneIdxvoid
# SetJointOneBoneIdx
C#
public void SetJointOneBoneIdx(int boneIdx);

Sets the index of the Bone2D node that is being used as the first bone in the TwoBoneIK modification.

Parameters
NameTypeDefault
boneIdxint—
SetJointTwoBone2DEntityvoid
# SetJointTwoBone2DEntity
C#
public void SetJointTwoBone2DEntity(EntityPath bone2DEntity);

Sets the Bone2D node that is being used as the second bone in the TwoBoneIK modification.

Parameters
NameTypeDefault
bone2DEntityEntityPath—
SetJointTwoBoneIdxvoid
# SetJointTwoBoneIdx
C#
public void SetJointTwoBoneIdx(int boneIdx);

Sets the index of the Bone2D node that is being used as the second bone in the TwoBoneIK modification.

Parameters
NameTypeDefault
boneIdxint—
SetTargetEntityvoid
# SetTargetEntity
C#
public void SetTargetEntity(EntityPath targetEntitypath);
Parameters
NameTypeDefault
targetEntitypathEntityPath—
SetTargetMaximumDistancevoid
# SetTargetMaximumDistance
C#
public void SetTargetMaximumDistance(float maximumDistance);
Parameters
NameTypeDefault
maximumDistancefloat—
SetTargetMinimumDistancevoid
# SetTargetMinimumDistance
C#
public void SetTargetMinimumDistance(float minimumDistance);
Parameters
NameTypeDefault
minimumDistancefloat—
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.