Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
IterateIK3D
繼承: ChainIK3D < IKModifier3D < SkeletonModifier3D < Node3D < Node < Object
被繼承: CCDIK3D, FABRIK3D, JacobianIK3D
通過重複進行小幅度旋轉來逐步接近目標的 SkeletonModifier3D。
說明
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 set_joint_rotation_axis() or set_joint_limitation() 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.
屬性
|
||
|
||
|
||
|
||
|
方法
屬性說明
float angular_delta_limit = 0.034906585 🔗
單次迭代中每根骨骼可以旋轉的最大角度。
注意:該限制在每次迭代中都會應用。例如,如果 max_iterations 為 4,angular_delta_limit 為 5 度,則單影格中可能的最大旋轉角度為 20 度。
如果為 false,則結果將以前一影格的 IterateIK3D 結果作為初始狀態進行計算。
如果為 true,則會丟棄前一影格的 IterateIK3D 結果。此時,新的結果將以除 IterateIK3D 之外的骨骼姿勢作為初始狀態進行計算。這意味著只要目標位置和之前的骨骼姿勢相同,結果就始終相同。但是,如果 angular_delta_limit 和 max_iterations 設定得太小,骨骼鏈的末端骨骼將永遠無法到達目標位置。
IK 求解器用於生成更精確結果的迭代循環次數。
末端骨骼與目標位置之間的最小距離。如果距離小於此值,IK 求解器將停止進一步迭代。
設定的數量。
方法說明
JointLimitation3D get_joint_limitation(index: int, joint: int) const 🔗
回傳骨骼鏈關節清單中 joint 的關節限制。
SecondaryDirection get_joint_limitation_right_axis(index: int, joint: int) const 🔗
回傳骨骼鏈關節清單中 joint 處的關節限制右軸。
Vector3 get_joint_limitation_right_axis_vector(index: int, joint: int) const 🔗
回傳骨骼鏈關節清單中 joint 處關節的右軸限制向量。
如果 get_joint_limitation_right_axis() 為 SkeletonModifier3D.SECONDARY_DIRECTION_NONE,則該方法回傳 Vector3(0, 0, 0)。
Quaternion get_joint_limitation_rotation_offset(index: int, joint: int) const 🔗
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 get_joint_limitation_right_axis_vector() 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 get_joint_limitation_right_axis_vector() 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 is_joint_using_rest_for_limitation().
RotationAxis get_joint_rotation_axis(index: int, joint: int) const 🔗
回傳骨骼鏈關節清單中 joint 關節的旋轉軸。
Vector3 get_joint_rotation_axis_vector(index: int, joint: int) const 🔗
回傳骨骼鏈中指定關節的旋轉軸向量。該向量表示關節可以繞其旋轉的軸。它根據為該關節設定的旋轉軸確定。
如果 get_joint_rotation_axis() 為 SkeletonModifier3D.ROTATION_AXIS_ALL,則該方法回傳 Vector3(0, 0, 0)。
NodePath get_target_node(index: int) const 🔗
回傳末端骨骼試圖到達的目標節點。
bool is_joint_using_rest_for_limitation(index: int, joint: int) const 🔗
Returns whether the limitation at joint in the bone chain's joint list is applied based on the Skeleton3D.get_bone_rest().
void set_joint_limitation(index: int, joint: int, limitation: JointLimitation3D) 🔗
設定骨骼鏈關節清單中 joint 處的關節限制。
void set_joint_limitation_right_axis(index: int, joint: int, direction: SecondaryDirection) 🔗
設定骨骼鏈關節清單中 joint 處的關節限制右軸。
void set_joint_limitation_right_axis_vector(index: int, joint: int, vector: Vector3) 🔗
設定骨骼鏈關節清單中 joint 處的可選關節限制右軸向量。
void set_joint_limitation_rotation_offset(index: int, joint: int, offset: Quaternion) 🔗
設定骨骼鏈關節清單中,指定 joint(關節)處的關節限制旋轉偏移量。
旋轉是在區域空間中進行的,這個區域空間的建置規則如下:以骨骼的朝向(通常是從父節點指向子節點)作為 +Y 軸,以 get_joint_limitation_right_axis_vector() 作為 +X 軸。
如果 +X 軸和 +Y 軸不垂直(正交),系統會自動修改 +X 軸,使其與 +Y 軸保持垂直。
此外,如果 get_joint_limitation_right_axis_vector() 的長度為零,系統會通過“最短弧”旋轉的方式,將參考姿態(reference pose)中原本的 +Y 軸旋轉至與目前骨骼朝向一致,以此建置出該區域空間。
這裡的“參考姿態”,指的是在處理 IK(反向運動學)之前的那一瞬間的骨骼姿態。
void set_joint_rotation_axis(index: int, joint: int, axis: RotationAxis) 🔗
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.ROTATION_AXIS_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 set_joint_rotation_axis() even if is_joint_using_rest_for_limitation() is true.
void set_joint_rotation_axis_vector(index: int, joint: int, axis_vector: Vector3) 🔗
設定骨骼鏈中指定關節的旋轉軸向量。
該向量會經過內部處理進行正規化,並代表骨骼鏈可以圍繞其旋轉的軸。
如果向量長度為 0,則被視為等同於 SkeletonModifier3D.ROTATION_AXIS_ALL。
void set_joint_use_rest_for_limitation(index: int, joint: int, enabled: bool) 🔗
Sets whether the limitation and the rotation axis at joint in the bone chain's joint list are applied based on the Skeleton3D.get_bone_rest(). See also set_joint_rotation_axis().
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.
void set_target_node(index: int, target_node: NodePath) 🔗
設定末端骨骼試圖到達的目標節點。