IterateIK3D
A SkeletonModifier3D to approach the goal by repeating small rotations.
A SkeletonModifier3D to approach the goal by repeating small rotations.
Base class of SkeletonModifier3D to approach the goal by repeating small rotations.
Each bone chain (setting) has one effector, which is processed in order of the setting list. You can set some limitations for each joint.
Note: All the methods in this class take an index parameter. This parameter specifies which setting list entry to return if the IK has multiple entries (e.g. settings/<index>/target_node).
Note: When IterateIK3D.SetJointRotationAxis or IterateIK3D.SetJointLimitation is set, the IK tip may not reach the target. This occurs because IK calculates the path through iterations, and in some cases, it may hit a limit during the process and fail to resolve. In some cases, this can be resolved by splitting the IK into several SkeletonModifier3Ds and setting the iteration order manually.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Properties5
AngularDeltaLimitProperty
public double AngularDeltaLimit { get; set; }The maximum amount each bone can rotate in a single iteration.
Note: This limitation is applied during each iteration. For example, if IterateIK3D.MaxIterations is 4 and IterateIK3D.AngularDeltaLimit is 5 degrees, the maximum rotation possible in a single frame is 20 degrees.
DeterministicProperty
public bool Deterministic { get; set; }If false, the result is calculated from the previous frame's IterateIK3D result as the initial state.
If true, the previous frame's IterateIK3D result is discarded. At this point, the new result is calculated from the bone pose excluding the IterateIK3D as the initial state. This means the result will be always equal as long as the target position and the previous bone pose are the same. However, if IterateIK3D.AngularDeltaLimit and IterateIK3D.MaxIterations are set too small, the end bone of the chain will never reach the target.
MaxIterationsProperty
public int MaxIterations { get; set; }The number of iteration loops used by the IK solver to produce more accurate results.
MinDistanceProperty
public double MinDistance { get; set; }The minimum distance between the end bone and the target. If the distance is below this value, the IK solver stops any further iterations.
SettingCountProperty
public int SettingCount { get; set; }The number of settings.
Methods24
GetAngularDeltaLimitdouble
public double GetAngularDeltaLimit();doubleGetJointLimitationJointLimitation3D
public JointLimitation3D GetJointLimitation(int index, int joint);Returns the joint limitation at joint in the bone chain's joint list.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
JointLimitation3DGetJointLimitationRightAxisSkeletonModifier3D.SecondaryDirection
public SkeletonModifier3D.SecondaryDirection GetJointLimitationRightAxis(int index, int joint);Returns the joint limitation right axis at joint in the bone chain's joint list.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
SkeletonModifier3D.SecondaryDirectionGetJointLimitationRightAxisVectorVector3
public Vector3 GetJointLimitationRightAxisVector(int index, int joint);Returns the joint limitation right axis vector at joint in the bone chain's joint list.
If IterateIK3D.GetJointLimitationRightAxis is SkeletonModifier3D.SecondaryDirection.None, this method returns Vector3(0, 0, 0).
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
Vector3GetJointLimitationRotationOffsetQuaternion
public Quaternion GetJointLimitationRotationOffset(int index, int joint);Returns the joint limitation rotation offset at joint in the bone chain's joint list.
Rotation is done in the local space which is constructed by the bone direction (in general parent to child) as the +Y axis and IterateIK3D.GetJointLimitationRightAxisVector as the +X axis.
If the +X and +Y axes are not orthogonal, the +X axis is implicitly modified to make it orthogonal.
Also, if the length of IterateIK3D.GetJointLimitationRightAxisVector is zero, the space is created by rotating the reference pose using the shortest arc that rotates the +Y axis of the reference pose to match the bone direction.
In here, the reference pose is the bone rest or bone pose immediately before processing IK depending on the IterateIK3D.IsJointUsingRestForLimitation.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
QuaternionGetJointRotationAxisSkeletonModifier3D.RotationAxis
public SkeletonModifier3D.RotationAxis GetJointRotationAxis(int index, int joint);Returns the rotation axis at joint in the bone chain's joint list.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
SkeletonModifier3D.RotationAxisGetJointRotationAxisVectorVector3
public Vector3 GetJointRotationAxisVector(int index, int joint);Returns the rotation axis vector for the specified joint in the bone chain. This vector represents the axis around which the joint can rotate. It is determined based on the rotation axis set for the joint.
If IterateIK3D.GetJointRotationAxis is SkeletonModifier3D.RotationAxis.All, this method returns Vector3(0, 0, 0).
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
Vector3GetMaxIterationsint
public int GetMaxIterations();intGetMinDistancedouble
public double GetMinDistance();doubleGetTargetEntityEntityPath
public EntityPath GetTargetEntity(int index);Returns the target node that the end bone is trying to reach.
| Name | Type | Default |
|---|---|---|
index | int | — |
EntityPathIsDeterministicbool
public bool IsDeterministic();boolIsJointUsingRestForLimitationbool
public bool IsJointUsingRestForLimitation(int index, int joint);Returns whether the limitation at joint in the bone chain's joint list is applied based on the Skeleton3D.GetBoneRest.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
boolSetAngularDeltaLimitvoid
public void SetAngularDeltaLimit(double angularDeltaLimit);| Name | Type | Default |
|---|---|---|
angularDeltaLimit | double | — |
SetDeterministicvoid
public void SetDeterministic(bool deterministic);| Name | Type | Default |
|---|---|---|
deterministic | bool | — |
SetJointLimitationvoid
public void SetJointLimitation(int index, int joint, JointLimitation3D limitation);Sets the joint limitation at joint in the bone chain's joint list.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
limitation | JointLimitation3D | — |
SetJointLimitationRightAxisvoid
public void SetJointLimitationRightAxis(int index, int joint, SkeletonModifier3D.SecondaryDirection direction);Sets the joint limitation right axis at joint in the bone chain's joint list.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
direction | SkeletonModifier3D.SecondaryDirection | — |
SetJointLimitationRightAxisVectorvoid
public void SetJointLimitationRightAxisVector(int index, int joint, Vector3 vector);Sets the optional joint limitation right axis vector at joint in the bone chain's joint list.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
vector | Vector3 | — |
SetJointLimitationRotationOffsetvoid
public void SetJointLimitationRotationOffset(int index, int joint, Quaternion offset);Sets the joint limitation rotation offset at joint in the bone chain's joint list.
Rotation is done in the local space which is constructed by the bone direction (in general parent to child) as the +Y axis and IterateIK3D.GetJointLimitationRightAxisVector as the +X axis.
If the +X and +Y axes are not orthogonal, the +X axis is implicitly modified to make it orthogonal.
Also, if the length of IterateIK3D.GetJointLimitationRightAxisVector is zero, the space is created by rotating the reference pose using the shortest arc that rotates the +Y axis of the reference pose to match the bone direction.
In here, the reference pose is the bone pose immediately before processing IK.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
offset | Quaternion | — |
SetJointRotationAxisvoid
public void SetJointRotationAxis(int index, int joint, SkeletonModifier3D.RotationAxis axis);Sets the rotation axis at joint in the bone chain's joint list.
The axes are based on the reference pose's space, if axis is SkeletonModifier3D.RotationAxis.Custom, you can specify any axis.
In here, the reference pose is the bone pose immediately before processing IK.
Note: The rotation axis and the forward vector shouldn't be colinear to avoid unintended rotation since ChainIK3D does not factor in twisting forces.
Note: Since IterateIK3D never modifies the twist, the twist is not fixed by IterateIK3D.SetJointRotationAxis even if IterateIK3D.IsJointUsingRestForLimitation is true.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
axis | SkeletonModifier3D.RotationAxis | — |
SetJointRotationAxisVectorvoid
public void SetJointRotationAxisVector(int index, int joint, Vector3 axisVector);Sets the rotation axis vector for the specified joint in the bone chain.
This vector is normalized by an internal process and represents the axis around which the bone chain can rotate.
If the vector length is 0, it is considered synonymous with SkeletonModifier3D.RotationAxis.All.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
axisVector | Vector3 | — |
SetJointUseRestForLimitationvoid
public void SetJointUseRestForLimitation(int index, int joint, bool enabled);Sets whether the limitation and the rotation axis at joint in the bone chain's joint list are applied based on the Skeleton3D.GetBoneRest. See also IterateIK3D.SetJointRotationAxis.
Note: The limitation is applied to the rotation computed by this modifier. If the reference pose is rotated around the same axis, the limitation behaves as if it also limits the rotation of the reference pose. A rotation that this modifier does not change, such as the twist, is not limited.
Note: The rendered gizmo's limitation shape will only respect the reference pose when this option is false and the modifier is active.
| Name | Type | Default |
|---|---|---|
index | int | — |
joint | int | — |
enabled | bool | — |
SetMaxIterationsvoid
public void SetMaxIterations(int maxIterations);| Name | Type | Default |
|---|---|---|
maxIterations | int | — |
SetMinDistancevoid
public void SetMinDistance(double minDistance);| Name | Type | Default |
|---|---|---|
minDistance | double | — |
SetTargetEntityvoid
public void SetTargetEntity(int index, EntityPath targetEntity);Sets the target node that the end bone is trying to reach.
| Name | Type | Default |
|---|---|---|
index | int | — |
targetEntity | EntityPath | — |