Search Unity

Active Ragdoll Sample

Discussion in 'Physics for ECS' started by Occuros, Feb 5, 2021.

  1. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    Greetings, a few months ago during the Unite Now (June 24. 2020) there was a short clip showing how unity physics works together with Animations.


    I was wondering if I somehow missed that sample in either the animations sample repo or the physics repo, or if the example and implementation aren't yet available.

    If so any hint on when we might be able to see it?

     
    MarsLars likes this.
  2. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    I have been hoping for something like that for quite some time. The current ragdoll example is cool and all, but not really "reusable". At this point, I would be thrilled to simply have an example of an actual model with ragdoll like in the "robot washing machine" demo, to at least have some sort of starting point.
     
  3. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    I was more referring to the combination of active ragdoll with Animation. Where the physics help to drive the animation and the animation drives the physics.
     
    MostHated likes this.
  4. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    Yes, I am aware. What I meant was, if there isn't even a basic ragdoll example using a model yet, unfortunately, I don't think we will be seeing an active ragdoll implementation any sooner either.

    I do hope that is wrong, as I, too, have been wanting some examples of this, as I am currently having to use a hacked-together hybrid of PuppetMaster in the GameObject world that transfers the direction and force of the collision when the vehicle entities hit the pedestrian entities and then enable PuppetMaster for the active ragdoll, then once the character regains composure and gets up, it all turns off and transfers positions back to the entity. It is extremely inefficient, to say the least, lol.

    https://i.imgur.com/lrwdWk7.mp4

    I would love to be able to keep everything within the ECS world, as when experimenting with the current ragdoll example, it just is so much more satisfying.

    https://i.imgur.com/XNm73J0.gifv

    So once I can ditch PuppetMaster and begin working in all ECS, it will be a great day.

    So +100 on some examples please, I do hope this gets some visibility and consideration!
     
    Last edited: Feb 8, 2021
    steveeHavok likes this.
  5. hirox_k

    hirox_k

    Joined:
    Apr 1, 2020
    Posts:
    2
    Any news? I too is looking for an example... no luck so far...
     
    MostHated likes this.
  6. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    I wrote my experience of the process https://forum.unity.com/threads/unity-ecs-physics-dots-animation-concept.1095292/ but suffice to say, its extremely tedious to setup, requires editing the animation package to make some stuff public, and since you cant even have animation events & statemachines are mia I dont think its worth it to pursue until animation gets more polish. That in combination with conversion workflow just fighting against hierarchical rigidbodies.
     
    hirox_k likes this.
  7. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    232
    you can just use an invisible ragdoll made of primitive parts like in the sample.
    then copy the positions of the spheres and stuff that comprimise the primitive to the actual bones of a humanoid rig.
     
  8. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    Sure, I could hack things together in an inefficient way that, to me, seems like it might be a good idea, or I could see how the actual creators of the system think it should be done for the best overall performance. I would much prefer that.
     
  9. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    232
    that is probably the intended solution.
    if they do make some 'official' solution, it would just be the same underneath:
    copy the transforms of the primitive parts in the sample ragdoll to the AnimatedLocalToRoot dynamic buffer.

    it can't be like how it is in the GameObject workflow where you just add ragdoll components to the bone game objects
    setting position of the bone entities doesn't do anything.
    a ragdoll requires many entities with colliders and joints, but the animation only uses 1 entity with a large dynamic buffer for every bone

    you can actually just destroy the ~50 human bones + ik + face entities during conversion.
    and just keep the SkinnedMeshRenderer object, its allot cleaner in the entity debugger
     
    Last edited: Nov 12, 2021