Fix JacobianIK to apply gradient correctly#112573
Conversation
c49ffde to
93c9f88
Compare
93c9f88 to
069206b
Compare
lyuma
left a comment
There was a problem hiding this comment.
I found a paper explaining the idea of squaring the delta angle from the Jacobian Transpose.
https://www.cs.cmu.edu/~15464-s13/lectures/lecture6/iksurvey.pdf section 5
So I'm inclined to agree that this change could help.
That said, I am concerned about the possibility of head_to_effector having length units (as opposed to a unitless ratio). From what I can tell, this variable is the difference between two values in p_setting->chain, which themselves are assigned directly from get_bone_global_pose(...).origin, which are in units of meters. However, get_bone_axis is normalizng the returned axis, producing a unitless value. Hence, the resulting angle used in to_rot appears to be in units of 1/length
I'd like to make sure that the IK produces different solutions between two equivalent skeletons with different uniform scales (for example, both a 1 meter humanoid reaching a target 1 meter away, and a 100 meter humanoid reaching a target 100 meters away should produce the same angle). During testing, it is common to use default cube or human scale skeletons with roughly 1 meter length head-to-effector, so it might obscure bugs that happen at very large or very small scale.
I'm okay trying this PR to solve issues at human scale, but we might want to test very small and very large skeletons to make sure that the distance between head and effector is properly divided out.
|
Thanks! |
|
follow further discussion of godot demo on 3D IK here |
The distance gradient ratio was not applied to angle correctly (it should be divided by powered 2 of the length), resulting in excessive rotation. And applying
angular_delta_limitclipping at an earlier stage allows users to prevent excessive rotation at their discretion.Also, the document incorrectly states “pseudo inverse matrix.” The correct method is the "Jacobian transpose" method. Fixed. cc @jitspoe
Before:
After:
Godot.Engine.2025.11.09.-.16.07.52.04.mp4