-
-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
Physical skeleton improvement and bug fix #28909
Conversation
@@ -343,6 +343,7 @@ void btMultiBody::finalizeMultiDof() | |||
m_deltaV.resize(6 + m_dofCount); | |||
m_realBuf.resize(6 + m_dofCount + m_dofCount * m_dofCount + 6 + m_dofCount); //m_dofCount for joint-space vels + m_dofCount^2 for "D" matrices + delta-pos vector (6 base "vels" + joint "vels") | |||
m_vectorBuf.resize(2 * m_dofCount); //two 3-vectors (i.e. one six-vector) for each system dof ("h" matrices) | |||
m_matrixBuf.resize(m_links.size() + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed? It should also be PR'ed upstream if it's a bugfix.
Merging that also means that we're no longer compatible with Bullet 2.88 which is the current stable release, so if we can handle this on our end without modifying Bullet for now, that would be best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope is not possible to manage it internally, I did a PR on the Bullet side also: bulletphysics/bullet3#2236 but in order to be able to use it ASAP I did it in this way
@AndreaCatania: I saw you showcase ragdoll/skeleton with this dummy, where can we get the assets? Is it on the asset lib? Getting skeletons working with Blender -> Godot can be tricky, it would be great to have an easily available working sample... |
@Zireael07 do you mean that you want to try it by yourself? |
I mean I could never get the skeleton exported from Blender to work, so if your dummy asset were generally available on the asset lib, it would be easier for people to get started with skeletons in Godot. It is just a tangential question since I saw you demo'ing various skeleton stuff with always the same dummy, the dummy is therefore guaranteed to work. |
Oh ok, To be fair this is where you can download it: https://www.mixamo.com/ and for this precise work I've used the skeleton from this guy: #28707 but yes indeed would be useful to make the skeleton import more easy. I'll try to look on that in the next days |
f88238c
to
a73ad18
Compare
I'm trying to test this branch but getting the following error when I run my project. Could you give me some help to resolve this problem?
|
This updates our local copy to commit 5ec8339b6fc491e3f09a34a4516e82787f053fcc. We need a recent master commit for some new features that we use in Godot (see godotengine#25543 and godotengine#28909). To avoid warnings generated by Bullet headers included in our own module, we include those headers with -isystem on GCC and Clang. Fixes godotengine#29503.
#29418 is merged so you can rebase on master to fix CI. |
Also this get merged bulletphysics/bullet3#2279 This weekend I'll be able to work on this. @mysticfall you want to active the multi body world in the settings. Check the physics tab in the project settings to active it. |
Done! |
editor/spatial_editor_gizmos.cpp
Outdated
|
||
const PhysicalBone::SliderJointData *sjd(static_cast<const PhysicalBone::SliderJointData *>(physical_bone->get_joint_data())); | ||
JointSpatialGizmoPlugin::CreateSliderJointGizmo( | ||
const PhysicalBone::SphericalJointData *sjd(static_cast<const PhysicalBone::SphericalJointData *>(physical_bone->get_joint_data())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is unused.
editor/spatial_editor_gizmos.cpp
Outdated
sdofjd->axis_data[2].linear_limit_enabled, | ||
case PhysicalBone::JOINT_TYPE_PLANAR: { | ||
|
||
const PhysicalBone::PlanarJointData *pjd(static_cast<const PhysicalBone::PlanarJointData *>(physical_bone->get_joint_data())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also unused.
Looks good to me overall. Couple unused variables which produce warnings, and Could you add some details on the changes in the body of the commit log? So that we have some information in |
Rework of the physical bone that aim to fix currently open issues and also improve the current Physical Bone by adding stability and control. The current Physical Bone implementation was using the normal rigid bodies and joints, and it worked well but became unstable if the complexity of the skeleton is not trivial, for this reason the Featherstone algorithm was implemented to allowing to have not only a stable body but also full control of it. It is now not only possible to create ragdolls of non-animated bodies, but is also possible to control its movement by adding forces with the `motor_*` methods. You don't have to deal with complex force systems, but instead you can control it by simply changing the motor target and/or velocity and some other parameters from the editor. It is now possible to create active ragdolls directly from script, or for example to create a completely physical walking robot, or to have a stable ragdoll with dumpers and springs. Fixes godotengine#19002 Fixes godotengine#22823 Fixes godotengine#24968 Fixes godotengine#25564 Fixes godotengine#26618 Fixes godotengine#28707
I force pushed an update to fix compilation warnings and build failure with I also synced the documentation so that we can see the actual API changes, which are compatibility breaking, so this will be difficult to merge for 3.2, will likely have to wait for 4.0. I tried it quickly on the 3D platformer demo and the TPS demo, and they both throw a lot of error simply when opening their main scene:
|
The APIs doesn't changed too much but some things are not compatible since I've also improved a bit the APIs. However the error that you got are mostly because you have to active the multibody world to use it. |
This updates our local copy to commit 5ec8339b6fc491e3f09a34a4516e82787f053fcc. We need a recent master commit for some new features that we use in Godot (see godotengine#25543 and godotengine#28909). To avoid warnings generated by Bullet headers included in our own module, we include those headers with -isystem on GCC and Clang. Fixes godotengine#29503.
Won't this PR be able to 3.2 (or 3.1.2)? :'( |
@AndreaCatania I'm having trouble with the motor velocity targets. In all of my testing nothing seems to happen when I set a velocity target (in the inspector or with scripts). This includes the "Snake" actor in your demo project (I uncommented the line in the script that set the velocity). I increased the max impulse of the chosen physical bone, but still got nothing. I don't see any errors for this, just no change in the simulation. |
@AndreaCatania Is this fix by any chance going to be merged for 3.2.2 release? |
@vickylance There are many merge conflicts in this pull request, and 3.2.2 is very close to being released, so I doubt it. |
@AndreaCatania What's the status on this PR for |
This PR has not received any new commits from the author for over a year and has many conflicts, closing. If this is rebased and updated to work with the latest master branch, this can be re-opened or a new PR can be opened. |
I'll rebase this work on master. Not sure if it's good to back port the code at this point to 3.2. I'll open another Pr. |
This PR is a rework of the physical bone that aim to fix all the current open issues and also improve the current Physical Bone by adding stability and control.
The current Physical Bone implementation is using the normal rigid bodies and joints, and it works good but it become unstable if the complexity of the skeleton is not trivial, for this reason the Featherstone algorithm got implemented thus allowing to have not only stable body but also full control of it.
When I talk about control I mean that with this PR is not only possible to create ragdoll of not animated body but is also possible control its movement by adding forces like the following:
This dummy is not animated using the animator, but it's animated controlling the motor of each bone, and the responsible code is simply:
You don't have to deal with complex force system, but instead you can control it just by changing motor target and or velocity and some other parameters from the editor.
Thanks to this new PR is now possible to create, the a lot discussed, active ragdoll directly in GDscript, or is possible to create a completely physical walking robot, or simply is possible to have a stable ragdoll with dumpers and springs.
But test it yourself to see the new features, and if you want you can use this project that I've to used to develop this new feature:
Multibody.zip
This PR Fix:
Fixes #28707
Fixes #26618
Fixes #25564
Fixes #24968
Fixes #22823
Fixes #19002