-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
New Demo: IK Demo #211
Comments
This would be totally awesome! I already saw your nice work and hoped you would share 😄 I saw that your system works in 3D space. Is it based on the skeleton node? How about using constraints? Would it be possible to get it working in 2D space too? I am asking because I was working on an IK system too but only for 2D space. It is based on the FABRIK algorithm by Andreas Aristidou and although this approach is intended to be used in 3D I was only interested in using it for some 2D models. Constraints still do not work as wanted because of deadlock situations but I'm sure I will get this working somehow. If your system would work with 2D models too I am interested how it compares in complexity and performance. And if not I could add my 2D implementation as another demo. |
Thanks pwab! 😃 My system uses a look-at-IK solver to calculate the rotations in 3D space. I use the skeleton node to get the bone transforms, do the some calculations, and then send the transform back. Currently the system is built around the skeleton node, but thinking about it the system should (in theory) be able to work with any node that has a look_at function with some slight modifications. Currently I do not have a constraint system in place. I have a relatively good on idea on what I need to do, but of course that generally means it's going to be harder than I think. That's cool that you are working on an IK system too! I couldn't wrap my head around translating the algorithms I found into code, so I just used the look-at-IK solver because I understood how it worked. That's really neat that you're using a tried and true algorithm! I'd love to see it in action! My system only works in 3D space currently, though it shouldn't be too hard to translate into 2D. That said, I wasn't planning on adding a 2D implementation, mostly because I primarily work in 3D and rarely use 2D 😆. If you want, I can see about making it work in 2D, or I can just leave it and we can use your (likely better) system for a 2D example. Regardless I'd be happy to compare our implementations! I found working on the IK system to be really fun, and I've learned (and still am learning) a lot of interesting math as I've gone along. |
Sounds good! Having two different demos adds more variety too! I have to say: WOW! Your system looks really good! (Totally blows mine out of the water 😆). I'm also having some trouble working around a couple deadlock situations in my version too (with multi bone IK chains), so you're not alone there. I wouldn't worry about making it a plugin if you don't want to. I've just made my a plugin in an effort to reuse it for the FPS tutorial. Also, no worries on the wait! Take your time, I don't mind waiting (and my apologizes if I made you feel pressured) |
No worries. This encourages me even more! :) Thanks to a recent twitter post by reduz I got some assets to test my system with sprites (cutout) instead of polygons. Works great too but I will have to place the sprites pivot points by the script itself. (Assets and License can be found in the godot-design repository) |
Nice! It looks like it works well with Godette (that's her name right?). I wish you luck! placing pivots in GDScript sounds like it could get interesting. Unfortunately a couple days ago I found I had a huge bug: My IK system didn't work with anything but a skeleton at origin with no rotation applied. Thankfully I've managed to fix the look-at-IK side of things (mainly it's just converting from skeleton space to global space) but I still have an annoying global rotation bug with my IK chain. After that, I'll have to see if differing scales brakes things or not... 😦 (At least it shouldn't be too hard to fix, in theory). I don't want to release something that only works in one very specific scenario, so I guess it's going to take a little longer than I hoped to release a demo. If all goes well, I'll have the bug(s) fixed this week, and then can clean up the code and get a demo made shortly after. |
Well, after several weeks of trying and working with 3 or so implementations, my two bone IK chain is entirely broken and I have no idea on how to fix it, nor how to make a new (working) version. I may try to add 2 bone IK chains in later, but for now I'm going to move forward without them! Hopefully I can start working on the IK demo soon (though it won't be nearly as impressive/useful... 😢 ) |
It seems you found some time to create some impressive stuff here. Congrats on successfully implementing FABRIK for your IK-Chains 👍 At the moment I can't spare any time for working on the 2D version as well. I also want to wait a little bit how the new Skeleton2D stuff is implemented. Maybe that will supersede my implementation of constructing virtual bones. |
Thanks! Everything seems to be working, and it even works with skeletons moved and/or rotated from origin. I tried add constraints, but I couldn't get it working, but for my uses I don't really need it. I'm probably going to skip constraints for now and maybe add it later. I decided to try using FABRIK since your IK implementation uses it. After reading FABRIK from several sources, this Roblox one was probably the best of the ones I found, and my implementation is heavily based on it. Knowing that it was at least possible for 2D gave me the inspiration to try and use it for 3D. So, thanks! 👍 I likely wouldn't have a working bone chain without your post!
Sounds good, and take all the time you need! Hopefully the Skeleton2D stuff will work similarly to Skeleton, but without some of the quirks. (For example: |
Alright, I've finished the plugin, made some examples, and now it's ready to be made into a PR! Where should I put it? Thoughts? |
Putting the demo into 3D seems fine. You could also provide an extra repository for the plugin itself. |
Okay. Thanks! |
i know this is old, but this is the only reference to 2D IK demo I could find on the repository. I opened the old 3D IK demo in Godot 4.1 but it has not been ported yet so it doesn't even run; and by just opening scenes, I can see there is no 2D example. @pwab 's examples look great, since the character is side view, I thought that maybe they managed to make flipping work right, as I got this issue: godotengine/godot#80252 But since it was Godot 3, many things may have changed since... Since this issue is old, I'll be glad to continue discussion elsewhere. |
I have been working on a relatively simple IK (inverse kinematics) system for Godot 3, intended to be used in the FPS tutorial I'm making. Now that the system is fairly stable, I thinking about maybe sharing the system here on the demo repository.
The IK system works both in the editor and at runtime, the performance is pretty good (though it could use some touching up in a few places), and the demo would add IK implementation for others to use and build on. The code could also help as a reference on how to make a EditorPlugin that reacts when exported variables are set and can show how to add nodes to the scene tree (at runtime and in the editor).
You can see the system in action here, here, and here.
I can add a few examples to show how to use the system (like dynamically placing feet on terrain. Another potential use case that I'd like to look into is making ragdolls)
I can also write a tutorial in the docs explaining how the system works. It's fairly simple and should be relatively easy for intermediate Godot users to understand.
What do you guys think?
The text was updated successfully, but these errors were encountered: