Changes to SkeletonIK:

* Removed the pointers to PhysicalBone in the code, as they were unused.
* Forward ported the SkeletonIK bone scaling fix I made from Godot 3.2 to Godot 4.0.
* Fixed issue where the root bone in the IK chain would not rotate correctly.
  * The issue turned out to be the update_chain function being called in solve. This would override the root bone transform incorrectly and that would cause it not to rotate after just a single solve. Removing the update_chain function fixes the issue and based on my testing there are no adverse effects.
  * While the old fix on this PR (prior to a force push) required a hack fix, this new fix does not!
* Removed the update_chain function. This change doesn't appear to have any adverse effects in any of the projects I tested (including with animations, Skeleton3D or otherwise, from AnimationPlayer nodes!)
* Fixed issue where the scale of the Skeleton node would change the position of the target, causing it not to work with skeletons that have a global scale of anything but 1.
This commit is contained in:
TwistedTwigleg
2020-07-27 15:27:58 -04:00
parent 057489b329
commit a622649876
2 changed files with 7 additions and 24 deletions

View File

@@ -52,7 +52,6 @@ class FabrikInverseKinematic {
// Bone info
BoneId bone = -1;
PhysicalBone3D *pb = nullptr;
real_t length = 0;
/// Positions relative to root bone
@@ -113,8 +112,6 @@ private:
/// Init a chain that starts from the root to tip
static bool build_chain(Task *p_task, bool p_force_simple_chain = true);
static void update_chain(const Skeleton3D *p_sk, ChainItem *p_chain_item);
static void solve_simple(Task *p_task, bool p_solve_magnet);
/// Special solvers that solve only chains with one end effector
static void solve_simple_backwards(Chain &r_chain, bool p_solve_magnet);