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

Erratic behaviour with physical bones (ragdoll) #29833

Closed
mysticfall opened this issue Jun 16, 2019 · 8 comments
Closed

Erratic behaviour with physical bones (ragdoll) #29833

mysticfall opened this issue Jun 16, 2019 · 8 comments

Comments

@mysticfall
Copy link
Contributor

Godot version:
master / e999929 (with #28909)

OS/device including version:
Majaro KDE / Nvidia GTX790

Issue description:
I tried to build a ragdoll setup using the new physical bones, but I encountered various erratic behaviours which prevented me from achieving a functional result.

For a test, I added just a single physical bone to the hip bone without any joint. The character is a kinematic body with a capsule collider and it uses animations (root motion) for locomotion.

I wanted to see if I can implement a 'ragdoll mode', which I can switch on by disabling the capsule collider and animation related components, then setting Skeleton.ActivePhysics = true.

However, when I switch on the ragdoll mode the character simply fell down through the floor, even though I'm pretty sure that both of the objects have proper coliision settings.

After some tweaking, I find out that when I change the weight ratio between the skeleton to its hipbone (physical bone) in a certain way (I haven't yet determined the exact condition), I could make the collision working.

But the problem is, the body seems to keep gaining momentum after it hits the floor, even when there's no constant force other than the gravity, as you can see from a video below:

https://www.youtube.com/watch?v=TS7S9FlWdrc

On a side note, I noticed that in the Multibody sample Andreas used for demonstrating his physical bone implementation, the skeleton was scaled down to 0.01 ratio. I'm not sure if it's relevant to the issue, but it's the only difference I could find between my project and the sample, and I think I heard it can cause problems if you scale physical components.

@slapin
Copy link
Contributor

slapin commented Jun 17, 2019

Well, ragdol requires a lot of tweaking to make it work at all, I'm not surprised. General Idvice I follow, but not getting perfect results like in mature engines are:

  1. Keep number fo pbones at minimum. Full character ragdoll won't ever work.
  2. Keep each limb pbones up to 2. Use capsules for collisions and cone joints.
  3. Add single torso bone, no hip bones. Use box for collision of torso pbone.
  4. Relax constraint limits so they don't hit constraints too much.

This way I managed to do something which remotely looks like ragdolls. If pbones were more like RigidBody and would allow linear and angular damping, that would give better rresults.

@slapin
Copy link
Contributor

slapin commented Jun 17, 2019

Ah, because of no damping, keep all masses at minimum of 1 or try to make them even lower.
In C++ you can do much more and try to reproduce Bullet's example ragdoll as this way you will have much better access to tweaking.

@AndreaCatania
Copy link
Contributor

Fun problem, do you have an sample project so I can test it?

@mysticfall
Copy link
Contributor Author

The problem happens with my open source project, but it's not possible to test the issue with it now because it doesn't even load with the latest revision of Godot.

I'm trying to find a way around that problem among other things. I'll eventually revisit this issue after that, and I'll try to report the current status of it and let you know how to reproduce the problem with my project, if possible.

@Calinou
Copy link
Member

Calinou commented May 25, 2020

Related to #19002.

@pouleyKetchoupp
Copy link
Contributor

@mysticfall Can you still reproduce this bug in Godot 3.2.3 or any later release? If so, please provide a reproduction project to help investigating.

@mysticfall
Copy link
Contributor Author

Sorry, I don't use Godot at the moment so can't confirm if it's still an issue. I'm happy with closing it though if there's noone else who experiences the problem now.

Thanks!

@pouleyKetchoupp
Copy link
Contributor

No worries! Closing.

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

7 participants