R3X-G1L6AME5H / Godot-Active-Ragdolls

Godot plugin that allows for Active Ragdoll simulations.
MIT License
49 stars 4 forks source link

Interact with Bone - grab specific Bone #1

Closed DigitalN8m4r3 closed 2 years ago

DigitalN8m4r3 commented 2 years ago

What am thinking about is a TWD Saints and Sinners style interaction with Active Ragdoll Characters

Interactive/Grabbing ingame as the User/player a specific/predifined Bone from the currently racing Active Ragdoll Character and by doing this, setting that NPCharacter into a Animation state such as halt/idle until either you let go or the npc`s health reaches 0

DigitalN8m4r3 commented 2 years ago

we got your work into our Godot Dojo, a VR Template (free and MIT Licensed) we are makin for the Godot community and i gotta say thank you, without the work you did, the stuff you see in the video, would not be possible

https://user-images.githubusercontent.com/56046022/193711490-aa39d230-6c89-41b4-b5b0-8f12539997f4.mp4

So this is one step closer to what we want to achieve would love to do some chit chat with you, am usualy on the godot xr discord channel

R3X-G1L6AME5H commented 2 years ago

@DigitalN8m4r3 Let me level with you, I sat there for solid 15 minutes replaying the video in disbelief. I tested it, of course, but I did not know it would work so well. Great job on setting up all those joints, I imagine it to be classified a form of tourture in some countries. Did you use it on Godot 3.x, or Godot 4?

Regarding the topic at hand, I think it is a bit out of the scope of this plugin; the grabbing I mean. This plugin is ment to offer a foundation for active ragdolls, not much more. Theoretically, there should be no issue with "grabbing" an active ragdoll with its animation going. But I fear that the player hand would be the biggest problem.

To "grab" something the hand has to apply exact opposite force to that of the object being grabbed. And given that a ragdoll is made up of objects of varying mass, and momentums, that would be a nightmare to code. Any mistake would result in both the rig, and the hand spasming uncontrolably; akin to what you see in those funny Gmod ragdoll compilations.

You could stop the active ragdoll animation which would then have the spasm last less, but not eliminate it entirely. Depending on the enviromental variables it could go from funny to buggy real fast; undefined behaviour to say the least.

Mayhaps if you had the ragdoll go completely limp you can avoid most of the physics troubles, in which case I can quicky patch up a way for the joints to stop following the animation. Actually, it might be smater to damp the forces the joints are exerting, so that (if you grabed the arm) you could make a sphere of influence around that point; having the animation still going, but being weaker around the grabbed area. That would be easier to code up, I feel.

Having the ragdoll freeze is another can of wroms entirely. Because we are working with rigid bodies here, forces apply. Unlike the godot provided Ragdoll framework, RigidBodies cannot be turned off. So god knows how that would go.

I never tried setting the positions of RigidBodies before, so I do not know if that would work. Its worth a shot. Either it buggs out of existance, spasms, or simply obliges; 33.33% win chances sound like betting odds to me.

Now, I am pretty sure you there is an INFINITE_INERTIA setting on some node in Godot. It makes all the forces applied on it null, so it would be perfect for this, if it exists in this context.

Otherwise my hail mary would be moving the enemy's ragdoll to another collision layer(or moving the player instead; would be easier) to avoid awkward physics interactions, and then directly applying a force, or position onto the grabbed bone. You could use add_force method. I also spot the integrate_forces method as a possible solution. Outside of that, I can't think of anything. I would like to re-emphasize how out of the scope of this addon this problem is. Alas, turning off/damping the effect of the animation on the ragdoll is something I will work on. It could be useful. That concludes my take. I hope you can get it working, because it really is some amazing work you are doing.

Peace.

DigitalN8m4r3 commented 2 years ago

currently we are using 3.5 stable, one of our members got collision hands done that are used in the video above and the one below those collision hands are able to collide with evrything and in vr they enable us to collide with characters in an interactive way The repo with the Collision Hands is up on the Dojo Github https://github.com/Godot-Dojo/Godot-XR-Collision-Hands and a working version can be checked out in VR on the Main Repo https://github.com/Godot-Dojo/Godot-XR-Avatar just load up the scene called slap (if you got a vr headset)

Now i know that this was totally out of scope but then again, had to start somewhere and this is the solution as when compared to for example unitys rootmotion puppetmaster, your addon is pretty close to it and i got some experience using puppetmaster.

Here is another video showing the use of a dagger on the dummy, now the dagger got no collision on it but we got a way to make heldable objects collideable as well, the katana in the slap level contains a working example of this

So yeah if you would give it a thought what would be needed would be actualy that a way to say it in puppetmaster terms - unpin/pin the puppet... or what you suggested Mayhaps if you had the ragdoll go completely limp you can avoid most of the physics troubles, in which case I can quicky patch up a way for the joints to stop following the animation. Actually, it might be smater to damp the forces the joints are exerting, so that (if you grabed the arm) you could make a sphere of influence around that point; having the animation still going, but being weaker around the grabbed area. That would be easier to code up, I feel. anyways thanks for your hard work on this and if we shall find a way to accomplish this, we most def will share it

https://user-images.githubusercontent.com/56046022/194148511-f01d26eb-0e11-43cc-b85d-1e1503aec9d6.mp4