Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Ragdoll flies out of parent when exploding, how to make it follow along?

Discussion in 'Physics' started by nicmarxp, May 13, 2018.

  1. nicmarxp

    nicmarxp

    Joined:
    Dec 3, 2017
    Posts:
    106
    I'm having ragdolls that fly when a grenade explodes, but they are flying out of it's parent, and I'm not sure how to avoid that, since I want them to get up again after flying away transitioning back with a get-up-animation.

    I might have a weird setup, but my structure looks like this:

    Unit (Scripts, NavMeshAgent, Animator for FSM)
    - ModelContainer (Animator)
    -- Bip001 (Container for all bones)
    --- Bip001_Pelvis (Rigidbody, Collider, Configurable Joint, Fixed joint -> connected to RagdollPuller)
    ---- All other body parts as normal children (Rigidbody, Collider, Configurable Joint)
    -- Mesh (Skinned mesh renderer)
    - RagdollPuller (Rigidbody, connected to Bip001_Pelvis with a Fixed joint)
    - HealthBar (Graphic)

    When an explosion happens, it's applied to RagdollPuller, and it nicely makes the ragdoll fly, however, since it's a child of Unit, the Unit stays in place, and when I disable the ragdoll, they snap back into it's original position.

    I first tried to have the Rigidbody and Fixed joint on the main gameobject (Unit), but that made them spin around like crazy.

    How would you setup a situation like this, to make it work in a better way?

    You can see what's happening since their health bars don't follow along:


    PS: I have bought the PuppetMaster asset, but since I will be animating around 50 characters in a scene, I figured it might use too much resources for this. If you've used Puppetmaster on a mobile application with good performance, please let me know.
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    4,541
    maybe some ideas for the bars
    - healthbars under head in hierarchy, and then use script or shader to keep them facing camera (and above head)
    - external script to move healthbars on head positions in the view (so they dont need to be child of unit either)
     
  3. nicmarxp

    nicmarxp

    Joined:
    Dec 3, 2017
    Posts:
    106
    Thanks, there was a billboard script for it but it’s disabled :)

    I think the solution is to have the ragdoll as the root object and put the scripts a level down, and the ragdoll-mover-object as a separate object. Not sure but will test again.. :)