-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Ragdoll - Physical bone node #11973
Ragdoll - Physical bone node #11973
Conversation
Is there any benefit to having a hierarchy in this case? Would it not be
simpler to just have PhysicalBones are children of skeleton? Otherwise I
belive if you want to set those transforms from Skeleton it will be a
mess.. as it will not necessarily represent the true skeleton hierarchy.
…On Mon, Oct 9, 2017 at 2:48 PM, Andrea Catania ***@***.***> wrote:
I've implemented new node "Physical bone" that has the function to
simulate ragdoll.
This new node is a physical node and like all physics nodes must have a
shape, and can usa a Joint.
The particularity of this node is that when it's attached to a skeleton
bone it'll copy its position to the bone skeleton.
Here a video that show that node in action: https://youtu.be/1pPmBq10TV8
Physical skeleton structure
As you can see each bone has one (or more) shape that represent the bone
collision, and a joint that is used to tie the bone with its parent bone.
[image: untitled2]
<https://user-images.githubusercontent.com/8342599/31346167-814f8dc0-ad18-11e7-8b2b-dc459efcae2f.png>
Each Physics Bone must be child of its parent bone and only the first bone
must be child of skeleton.
Maintain this structure is necessary to be sure to use the inverse
kinematic solver (that will be implemented)
(of course the first bone must be joint free)
I've also created a function that automatically create the physics
skeleton, the only problem with this function is that it'll create a
Physical Bone for each bone in the skeleton and this is not the best thing
to do for performance reason. Its main objective is to give to the artist /
developer a quick understanding of how to create a physics skeleton
structure.
[image: untitled]
<https://user-images.githubusercontent.com/8342599/31346263-ccec2194-ad18-11e7-9f35-60cacd9de19f.png>
Function
By default physics simulation is stopped. You can start/stop it by using
the skeleton function:
void physical_bones_simulation(bool start); that active the simulation to
all physics bone attached. Otherwise you can active bone simulation one by
one by using the PhysicalBone function void set_simulate_physics(bool
p_simulate);
Other two utility function in skeleton are:
void physical_bones_add_collision_exception(RID p_exception);
void physical_bones_remove_collision_exception(RID p_exception);
Use these to set the parent collision body as exception
Known issue:
If you scale the skeleton in some way the shape size remain unscaled, this
is fixed by bullet implementation that allow physics body scaling.
N.B.
This video was taken using Godot physics. This mean that this
implementation is not Bullet dependent.
------------------------------
You can view, comment on, or merge this pull request online at:
#11973
Commit Summary
- Implemented ragdoll
File Changes
- *M* editor/editor_node.cpp
<https://github.com/godotengine/godot/pull/11973/files#diff-0> (2)
- *A* editor/plugins/skeleton_editor_plugin.cpp
<https://github.com/godotengine/godot/pull/11973/files#diff-1> (205)
- *A* editor/plugins/skeleton_editor_plugin.h
<https://github.com/godotengine/godot/pull/11973/files#diff-2> (96)
- *M* scene/3d/physics_body.cpp
<https://github.com/godotengine/godot/pull/11973/files#diff-3> (186)
- *M* scene/3d/physics_body.h
<https://github.com/godotengine/godot/pull/11973/files#diff-4> (39)
- *M* scene/3d/skeleton.cpp
<https://github.com/godotengine/godot/pull/11973/files#diff-5> (45)
- *M* scene/3d/skeleton.h
<https://github.com/godotengine/godot/pull/11973/files#diff-6> (5)
- *M* scene/register_scene_types.cpp
<https://github.com/godotengine/godot/pull/11973/files#diff-7> (1)
Patch Links:
- https://github.com/godotengine/godot/pull/11973.patch
- https://github.com/godotengine/godot/pull/11973.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#11973>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z22Gvlnc__cklkCFcO1G5JSk5W3dEks5sqlxZgaJpZM4Py1jC>
.
|
Initially I had developed it in a way were all physical bones were all childs of skeleton. I changed it as you see now, after the conversation with you where you told me that we need a way to iterate over each bone and find its joint in order to calculate inverse kinematic. If I had leaved all bones as childs of skeleton I was needed a way to map all physical bones in order to find the correct parent bone during inverse kinematic calculation So I thought that the best solution was to create this hierarchy directly in the editor; so is easy find a parent and process inverse kinematic. However the physical bone is set as toplevel node so there shouldn't be any difference in the performance. Probably your concern is the creation of these bones, and I can reassure you it's tedius in both way :D. So I'm thinking about a way to create these bone easily. For example implement a dedicated menu to create bones automatically, by the selection of initial bone and final bone so the system can calculate the shape and joint. But I just need some time to do that. |
If you set a physics bone to a skeleton bone (pick it from a menu in a
property), the hierarchy should be implicit.. there should be no need to
make it explicit in my opinion. BoneAttachment works this way too.
Agreed with you. I think Unity has a ragdoll tool, we could research how it
works.. so bones can just be corrected afterwards or used for non humanoid
skeletons
…On Oct 9, 2017 3:40 PM, "Andrea Catania" ***@***.***> wrote:
Initially I had developed it in a way were all physical bones were all
childs of skeleton. I changed it as you see now, after the conversation
with you where you told me that we need a way to iterate over each bone and
find its joint in order to calculate inverse kinematic.
If I had leaved all bones as childs of skeleton I was needed a way to map
all physical bones in order to find the correct parent bone during inverse
kinematic calculation
So I thought that the best solution was to create this hierarchy directly
in the editor; so is easy find a parent and process inverse kinematic.
Another benefit (that I noticed during the implementattion) is the order,
in this moment manage these nodes is very easy even with a lot of nodes.
However the physical bone is set as *toplevel* node so there shouldn't be
any difference in the performance.
Probably your concern is the creation of these bones, and I can reassure
you it's tedius in both way :D. So I'm thinking about a way to create these
bone easily.
For example implement a dedicated menu to create bones automatically, by
the selection of initial bone and final bone so the system can calculate
the shape and joint. But I just need some time to do that.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11973 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z220GCVjuuCdgmEFVcOVE6ui6cq_Zks5sqmiogaJpZM4Py1jC>
.
|
Looks interesting. This is actually very similar to a system I prototyped with scripts, but of course more tightly integrated. |
Can it also do partial ragdolls like my system does, where some bones are controlled by the animation system while others are simulated by physics? |
@AndreaCatania I have simmilar question to @SaracenOne 's. I would also make collision exception as PhysicsBone property. It works similar in UE4 PhysicsAsset (ragdoll) editor. PS |
@reduz I've implemented some functions that allow to have any type of hierarchy in the editor since now the hierarchy is managed internally. I've added this function @SaracenOne, @n-pigeon
I'm not sure what you mean with "blend by weight pose" but yes, it's possible have animation and physics at same time. To improve this aspect I've also added some function. Here a video that show how it works (the last part could be a bit strange but it demonstrate how static body parameter works) https://youtu.be/GA2X5BcL2ZM. In this video you can see that I can start the physics simulation in any time of animation. I'm glad that you enjoy it!! :) |
4557b13
to
413d454
Compare
@AndreaCatania This is really cool stuff for me :D Can't wait to use it. Maybe I will have some time tonight, to play with your branch :D |
In teory it is possible, but it'll apply other layer of calculation and the physics effect could not be so real or good... So I don't know if it's good. Probably what you need to use is the relaxation parameter that is present in some joints (like: Hinge, Cone, etc..) in this way you are able to create a ragdoll more controllated because the joints are more elastic. I've to insert some parameters in the physical bone, like the mass friction, etc.. I'll look also for this. However can you tell me an engine that does this blending so I can see its effect? |
I think the talk is about UE4 and thing called "active ragdoll"
…On Thu, Oct 12, 2017 at 10:25 AM, Andrea Catania ***@***.***> wrote:
In teory it is possible, but it'll apply other layer of calculation and
the physics effect could not be so real or good... So I don't know if it's
good.
Probably what you need to use is the relaxation parameter that is present
in some joints (like: Hinge, Cone, etc..) in this way you are able to
create a ragdoll more controllated because the joints are more elastic.
I've to insert some parameters in the physical bone, like the mass
friction, etc.. I'll look also for this.
However can you tell me an engine that does this blending so I can see its
effect?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#11973 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAX05hm5oUlZIpSn61_bug3kwFgHwW8ks5srb7igaJpZM4Py1jC>
.
|
So we are talking about muscle simulation like "Euphoria engine" does. https://www.youtube.com/watch?v=87qdmuOesRs This is not a pure ragdoll system |
This video is too funny: https://www.youtube.com/watch?v=QjGc2XBIEgQ |
Let's first start with full and partial ragdoll support... Then we can add
IK and other features
On Oct 12, 2017 9:38 AM, "Andrea Catania" <notifications@github.com> wrote:
So we are talking about muscle simulation like "Euphoria engine" does.
https://www.youtube.com/watch?v=87qdmuOesRs
This is not a pure ragdoll system
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#11973 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z2zpRuX37T3RzliQKBfGJgGfEfbceks5srggtgaJpZM4Py1jC>
.
|
43794ff
to
994b2c4
Compare
I inserted the icon, included missing physics parameters, and I had rebased it to 1 commit. Let me know if there's something missing or that must be improved. |
@AndreaCatania Although maybe this would be better to control from future 3.x animation system using blends. I was just curious if it is already possible. :) |
@n-pigeon yes I agree with you "active ragdoll" is way better than pure physics ragdoll. However I don't know if it's just an animation blending... I want investigate more about it... |
Well, there is quite some GDC videos mentioning subject - look for
Uncharted and Overgrowth videos.
Uncharted videos are also good for the one who will write layered animation
system
(also Urho3D animation system can work as example).
…On Fri, Oct 13, 2017 at 2:12 AM, Andrea Catania ***@***.***> wrote:
@n-pigeon <https://github.com/n-pigeon> yes I agree with you "active
ragdoll" is way better than pure physics ragdoll.
However I don't know if it's just an animation blending... I want
investigate more about it...
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11973 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAX0-ApBp-DILBQGg6eixLVSI0MAjm5ks5srpzggaJpZM4Py1jC>
.
|
@AndreaCatania @slapin |
Code looks good for the most part, but as I mentioned, I'am against using regular joints for this. |
|
||
PhysicalBone(); | ||
~PhysicalBone(); | ||
|
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.
While not generally using joints if you want with this, these bones should include the same information that will be used for IK. This is, an option between:
- Joint Disabled
- A Regular pin
- A Cone twist
- A Hinge
and relevant options. The joint would be created by this bone and attachment between it and the parent bone, as well as collision exception, would be handled in this class.
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.
Will also need an offset from the center of mass.
ed2d68a
to
7d7613b
Compare
adea3e9
to
e40ad28
Compare
Here a video to show how ragdoll looks like now: https://youtu.be/6TyRFk6dpU4 |
4ba2c4b
to
04824d3
Compare
Awesome work! I understand joint settings are placed in PhysBone Node? Unreal4 allows to test ragdoll in viewport in various useful ways. |
Yep it is inside physical bone
It's very useful to test it inside editor, and it's easy to make even in Godot, But I prefer as first thing that it is merged |
Implementing ragdoll Implementing ragdoll Implementing ragdoll Implementing ragdoll Implementing ragdoll a Implemented implicit hierarchy. Improved Added some physics properties Added bone offset to preserve COM, partially fixed scaling work in progress WIP wip Implemented Joint Gizmos Implemented pin joint joint Implemented all joints
Rebased |
@AndreaCatania Can this be used to set up jiggle bones like this addon does so greatly Video/example project would be awesome! 👍 |
@blurymind Right now without any addition you can achieve this result: https://youtu.be/p1eDWQaqoZE Basically what is required to do to get the same result is implement active ragdoll that is something that I've to work on after the merging of IK |
Sorry for OT, but about IK - will it be possible to use chains of bones
where not all bones are controlled by IK, i.e. limbs with 2 bones per part,
like in Rigify or Makehuman default rig? The same question is about
ragdolls though.
…On Thu, May 10, 2018 at 11:50 AM, Andrea Catania ***@***.***> wrote:
@blurymind <https://github.com/blurymind> Right now without any addition
you can achieve this result: https://youtu.be/p1eDWQaqoZE
Basically what is required to do to get the same result is implement
active ragdoll that is something that I've to work on after the merging of
IK
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#11973 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAX0608lk4LU6Tqlmun6k8VxCn8Ilziks5tw_9FgaJpZM4Py1jC>
.
|
@slapin with ragdoll you can do it right now, you don't need (and you don't have to do) create a bone for each bone of the skeleton (for example you don't need to add all 10-30 bones of the hand to have a good ragdoll of a character). I'll write an article about it, to explain how it works. For IK in this moment all bones of chain participate to the solving. But I prefer to talk about it here: #18699. For example why do you need to keep a particular bone rigid? |
@AndreaCatania I tried using PhysicalBones from the latest possible build earlier (with Skeleton -> Create physical skeleton) and couldn't get it to work. |
@hedgehog90 You don't need to add a physical body to the root. I'll write a short article to show how it works. |
I've written the article that explain ragdolls, you can find it here: https://godotengine.org/article/godot-ragdoll-system |
@hedgehog90 don't forget to apply the last section of article "Collision Layer and Mask" Let me know if you fix it. |
OK, I've realised that deleting ancestral physical bones causes their children to go nutty, or detach completely, falling to the floor and not moving with the character. Similarly, the robot character does not act like it does in your example. His arms don't flail quite so wildly anymore but they never stop moving. Perhaps you could upload the modified Platformer 3D project and I could try compiling it? |
@hedgehog90 can you please open an issue with this example project attached on and mention me? So I can verify what's the problem |
I've implemented new node "Physical bone" that has the function to simulate ragdoll.
This new node is a physical node and like all physics nodes must have a shape, and can usa a Joint.
The particularity of this node is that when it's attached to a skeleton bone it'll copy its position to the bone skeleton.
Here a video that show that node in action: https://youtu.be/1pPmBq10TV8
Physical skeleton structure
As you can see each bone has one (or more) shape that represent the bone collision, and a joint that is used to tie the bone with its parent bone.
Each Physics Bone must be child of its parent bone and only the first bone must be child of skeleton.
Maintain this structure is necessary to be sure to use the inverse kinematic solver (that will be implemented)
(of course the first bone must be joint free)
I've also created a function that automatically create the physics skeleton, the only problem with this function is that it'll create a Physical Bone for each bone in the skeleton and this is not the best thing to do for performance reason. Its main objective is to give to the artist / developer a quick understanding of how to create a physics skeleton structure.
Function
By default physics simulation is stopped. You can start/stop it by using the skeleton function:
void physical_bones_simulation(bool start);
that active the simulation to all physics bone attached. Otherwise you can active bone simulation one by one by using the PhysicalBone functionvoid set_simulate_physics(bool p_simulate);
Other two utility function in skeleton are:
Use these to set the parent collision body as exception
Known issue:
If you scale the skeleton in some way the shape size remain unscaled, this is fixed by bullet implementation that allow physics body scaling.
N.B.
This video was taken using Godot physics. This mean that this implementation is not Bullet dependent.