SkeletonModification2DCcdik
A modification that uses CCDIK to manipulate a series of bones to reach a target in 2D.
A modification that uses CCDIK to manipulate a series of bones to reach a target in 2D.
This SkeletonModification2D uses an algorithm called Cyclic Coordinate Descent Inverse Kinematics, or CCDIK, to manipulate a chain of bones in a Skeleton2D so it reaches a defined target.
CCDIK works by rotating a set of bones, typically called a "bone chain", on a single axis. Each bone is rotated to face the target from the tip (by default), which over a chain of bones allow it to rotate properly to reach the target. Because the bones only rotate on a single axis, CCDIK can look more robotic than other IK solvers.
Note: The CCDIK modifier has ccdik_joints, which are the data objects that hold the data for each joint in the CCDIK chain. This is different from a bone! CCDIK joints hold the data needed for each bone in the bone chain used by CCDIK.
CCDIK also fully supports angle constraints, allowing for more control over how a solution is met.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
SkeletonModification2DCcdikConstructor
public SkeletonModification2DCcdik();Properties3
CcdikDataChainLengthProperty
public int CcdikDataChainLength { get; set; }The number of CCDIK joints in the CCDIK modification.
TargetEntitypathProperty
public EntityPath TargetEntitypath { get; set; }The EntityPath to the node that is the target for the CCDIK modification. This node is what the CCDIK chain will attempt to rotate the bone chain to.
TipEntitypathProperty
public EntityPath TipEntitypath { get; set; }The end position of the CCDIK chain. Typically, this should be a child of a Bone2D node attached to the final Bone2D in the CCDIK chain.
Methods20
GetCcdikDataChainLengthint
public int GetCcdikDataChainLength();intGetCcdikJointBone2DEntityEntityPath
public EntityPath GetCcdikJointBone2DEntity(int jointIdx);Returns the Bone2D node assigned to the CCDIK joint at joint_idx.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
EntityPathGetCcdikJointBoneIndexint
public int GetCcdikJointBoneIndex(int jointIdx);Returns the index of the Bone2D node assigned to the CCDIK joint at joint_idx.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
intGetCcdikJointConstraintAngleInvertbool
public bool GetCcdikJointConstraintAngleInvert(int jointIdx);Returns whether the CCDIK joint at joint_idx uses an inverted joint constraint. See SkeletonModification2DCcdik.SetCcdikJointConstraintAngleInvert for details.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
boolGetCcdikJointConstraintAngleMaxfloat
public float GetCcdikJointConstraintAngleMax(int jointIdx);Returns the maximum angle constraint for the joint at joint_idx.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
floatGetCcdikJointConstraintAngleMinfloat
public float GetCcdikJointConstraintAngleMin(int jointIdx);Returns the minimum angle constraint for the joint at joint_idx.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
floatGetCcdikJointEnableConstraintbool
public bool GetCcdikJointEnableConstraint(int jointIdx);Returns whether angle constraints on the CCDIK joint at joint_idx are enabled.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
boolGetCcdikJointRotateFromJointbool
public bool GetCcdikJointRotateFromJoint(int jointIdx);Returns whether the joint at joint_idx is set to rotate from the joint, true, or to rotate from the tip, false. The default is to rotate from the tip.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
boolGetTargetEntityEntityPath
public EntityPath GetTargetEntity();EntityPathGetTipEntityEntityPath
public EntityPath GetTipEntity();EntityPathSetCcdikDataChainLengthvoid
public void SetCcdikDataChainLength(int length);| Name | Type | Default |
|---|---|---|
length | int | — |
SetCcdikJointBone2DEntityvoid
public void SetCcdikJointBone2DEntity(int jointIdx, EntityPath bone2DEntitypath);Sets the Bone2D node assigned to the CCDIK joint at joint_idx.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
bone2DEntitypath | EntityPath | — |
SetCcdikJointBoneIndexvoid
public void SetCcdikJointBoneIndex(int jointIdx, int boneIdx);Sets the bone index, bone_idx, of the CCDIK joint at joint_idx. When possible, this will also update the bone2d_node of the CCDIK joint based on data provided by the linked skeleton.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
boneIdx | int | — |
SetCcdikJointConstraintAngleInvertvoid
public void SetCcdikJointConstraintAngleInvert(int jointIdx, bool invert);Sets whether the CCDIK joint at joint_idx uses an inverted joint constraint.
An inverted joint constraint only constraints the CCDIK joint to the angles outside of the inputted minimum and maximum angles. For this reason, it is referred to as an inverted joint constraint, as it constraints the joint to the outside of the inputted values.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
invert | bool | — |
SetCcdikJointConstraintAngleMaxvoid
public void SetCcdikJointConstraintAngleMax(int jointIdx, float angleMax);Sets the maximum angle constraint for the joint at joint_idx.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
angleMax | float | — |
SetCcdikJointConstraintAngleMinvoid
public void SetCcdikJointConstraintAngleMin(int jointIdx, float angleMin);Sets the minimum angle constraint for the joint at joint_idx.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
angleMin | float | — |
SetCcdikJointEnableConstraintvoid
public void SetCcdikJointEnableConstraint(int jointIdx, bool enableConstraint);Determines whether angle constraints on the CCDIK joint at joint_idx are enabled. When true, constraints will be enabled and taken into account when solving.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
enableConstraint | bool | — |
SetCcdikJointRotateFromJointvoid
public void SetCcdikJointRotateFromJoint(int jointIdx, bool rotateFromJoint);Sets whether the joint at joint_idx is set to rotate from the joint, true, or to rotate from the tip, false.
| Name | Type | Default |
|---|---|---|
jointIdx | int | — |
rotateFromJoint | bool | — |
SetTargetEntityvoid
public void SetTargetEntity(EntityPath targetEntitypath);| Name | Type | Default |
|---|---|---|
targetEntitypath | EntityPath | — |
SetTipEntityvoid
public void SetTipEntity(EntityPath tipEntitypath);| Name | Type | Default |
|---|---|---|
tipEntitypath | EntityPath | — |