Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSOC 2020 3D IK PR enhancements #3099

Open
TwistedTwigleg opened this issue Aug 7, 2021 · 6 comments
Open

GSOC 2020 3D IK PR enhancements #3099

TwistedTwigleg opened this issue Aug 7, 2021 · 6 comments

Comments

@TwistedTwigleg
Copy link

TwistedTwigleg commented Aug 7, 2021

Describe the project you are working on

Godot Engine

Describe the problem or limitation you are having in your project

This proposal outlines some ideas that were unable to make it into the work I did on 3D Inverse Kinematics as part of Google Summer of Code 2020. None of these enhancements are groundbreaking, but they would be nice to have and/or discuss the possibility of adding at a later date.

The non squashed 3D IK PR can be found here: godotengine/godot#39353
The squashed 3D IK PR PR can be found here: godotengine/godot#51368

NOTE - this proposal is currently a work in progress, as I still need to go through the code itself and migrate any TODOs there to this proposal

Describe the feature / enhancement and how it helps to overcome the problem or limitation

This proposal outlines some useful enhancements to the 3D IK system that I was unable to make in the PR:

  • Convert the SkeletonIK node to use SkeletonModification3DFABRIK.
  • Convert the PhysicalBone3D node and code so it can function as a SkeletonModification3D
  • Optimize the rotate_to_align function in Basis
  • Add collision exception support to Jiggle modifier

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Some thoughts on how these ideas could be implemented:

  • Convert the SkeletonIK node to use SkeletonModification3DFABRIK
    • Should be relatively easy to do, I think. The node would need to just have a reference to the Skeleton3D node and then pretend to be a SkeletonModificationStack3D to setup and execute the modification every _process call on the SkeletonIK node. However, this may require some modifications to the base implementation of SkeletonModification3D resources, as they were only designed to be run from a SkeletonModificationStack3D
    • An alternative way is to have the SkeletonIK node internally keep it's own SkeletonModificationStack3D that is not exposed to the user, with it always having a single SkeletonModification3DFABRIK whose properties are exposed.
  • Convert the PhysicalBone3D node and code so it can function as a SkeletonModification3D
    • See PhysicalBone2D for an idea on how this could be achieved.
    • The idea is that PhysicalBone3D would become a full functioning, standalone node that extends RigidBody3D. Then it could use the same API and interface, but with some additional adjustments so it follows bones as expected.
    • The modification then would be responsible for mirroring the current PhysicalBone3D API and for operating on multiple PhysicalBone3D nodes at once (as well as mixing them with other IK modifications, I suppose)
  • Optimize the rotate_to_align function in Basis
    • I actually tried to do this in Twisted IK 2, but I found using the optimized code at the source I based the function on lead to different behavior. However, it is possible that I implemented it wrong. It could be possible to improve the function for better performance.
  • Add collision exception support to Jiggle modifier
    • Should just need to have a function exposed that will append physics bodies to a list that can be passed to the raycast code in the modifier.

If anyone wants to work on any of these enhancements after the 3D IK PR is merged, please feel free to do so! I probably will not be looking into implementing them myself, at least not soon due to time constraints. If you do decide to try to implement any of these features and get stuck, feel free to reach out and I'll do my best to assist as I can.

If this enhancement will not be used often, can it be worked around with a few lines of script?

The code would need to be implemented in Godot source since the features it's enhancing are designed and implemented for Godot source.

Is there a reason why this should be core and not an add-on in the asset library?

Technically, as I have created a IK plugin for Godot 3 that includes all the features of my GSOC implementation and several more, it isn't strictly required to be in core. However, the plugin is closed source, written using a different architecture for IK, and is only free for non-commercial use.

These enhancements and the 3D IK PR itself being included officially as part of the Godot source code will give easier access to different IK solutions for all developers, as well as give the community an open-source solution that anyone can contribute to, use as reference, and extend.

@atirut-w
Copy link

The squashes PR is merged, does it mean this issue should be closed?

@TwistedTwigleg
Copy link
Author

This proposal is to mention improvements to the 3D IK pull request that there was no time to add in that PR due to time constraints.
We can close this issue if the tasks are deemed no longer needed or necessary.

@GeorgeS2019
Copy link

No follow up

godotengine/godot#51368 (comment)

@GeorgeS2019
Copy link

GeorgeS2019 commented Mar 29, 2023

@TwistedTwigleg

Could you please update what is the status of Godot4 3D IK demo?

@TwistedTwigleg
Copy link
Author

I have no idea. I made an IK demo for GSOC in 2020, but I have not touched it sense then. I’m not really involved with Godot development anymore.

A lot of the IK stuff was pulled out for Godot 4.0, so I am not sure how much would even be usable anyway.

This should probably be closed, as the changes it refers to are for the IK system that was removed.

@GeorgeS2019
Copy link

GeorgeS2019 commented May 25, 2023

@TwistedTwigleg
Do check this new SkeletonIK3D merged feature to feedback if this proposal could be closed

SkeletonIK3D bone roll axis is not working correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants