Announcement

Collapse
No announcement yet.

"Grab" a ragdoll by a bone?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    "Grab" a ragdoll by a bone?

    I'm sure there's a way to do this, but the heck if I can find it!

    I've got a few attacks that grab/swing the enemy in question; for visual reasons, I want the enemy to temporarily enter a ragdoll state when these attacks trigger, so the enemy is flung around limp and then re-blends to his animations on landing. I can handle this just fine by setting physics blend weights

    The problem is, if I try to go full ragdoll (i.e. not simulate just part of the mesh), then the enemy's collision capsule moves but the mesh simply crumbles into a heap! Going full ragoll detaches the mesh from the capsule (effectively), so it doesn't move with it. What I need is a way to simulate physics on all bones EXCEPT a single bone (be it torso, or leg, or whatever), or else simulate physics and manually attach/copy locrot a bone for the duration of the effect.

    It seems like this should be doable; you can do it in your PhAT sim with the poke controls! But I can't find a way to achieve this in-game, so that the ragdoll asset is dragged along by the bone in question.

    And I realize that reconstructing the skeleton might work, so that all of the bones ("below" an invisible parent bone) simulate, but this doesn't work if I want different attacks to function differently; i.e. have one attack where the enemy is caught by his chest, another where he's caught by his legs, etc.

    #2
    I think you might want to add a socket to the ragdoll. Most things connect to the hands via a socket.

    Comment


      #3
      I don't think that works. The problem is I would need to set the relative location of a bone in a way that would update the physics asset; I can add forces at bones (impulses, momentum, whatever) but I can't set their location or rotation.

      Comment


        #4
        Use a UPhysicsHandleComponent, call the grabcomponent function so it grabs your mesh / physical asset and then use the SetTargetLocation and provide the location to move the component to

        You can check how its exactly done in the Content Examples demo, physics map
        Offering my Freelance Game Design ,Counselling and C++ Programming Skills!
        https://forums.unrealengine.com/show...ner-Counseling

        Marketplace Assets
        Melee Tracing Plugin:https://forums.unrealengine.com/show...Tracing-Plugin
        Medieval Combat Starter Kit:https://forums.unrealengine.com/show...at-Starter-Kit
        Foliage To Blueprint:https://www.unrealengine.com/marketp...e-to-blueprint

        Comment


          #5
          This doesn't seem to do anything, alvarofer. I must be doing it wrong, can you see where my mistake is?

          Click image for larger version

Name:	BPlayout.png
Views:	1
Size:	159.0 KB
ID:	1056361
          Pic related is the BP I'm using. As far as I can tell, this should work, right? I have a physics handle component on my pawn (attached at the root like a movement component, which I can't change). When I trigger the ragdoll, the whole skeleton simulates physics. Then, I attach the handle to the bone I want to "carry" using (which in this case is a reference to a bone called SpinalBase which I'm pulling from somewhere else). Then I use a timeline to tick the location of the handle using set target loc and rot, which is fed using the pawn's capsule.

          The end result SHOULD be that the mesh goes full ragdoll, but the torso is attached to the capsule and moves with it, with the rest of the ragdolling mesh being carried behind. Right?

          But in practice...
          Click image for larger version

Name:	PhysicsHandleFailure.png
Views:	1
Size:	454.9 KB
ID:	1056362
          the skeletal mesh remains stationary and crumbles into a heap, completely ignoring the position and rotation of the actor's capsule.

          Comment


            #6
            I feel like maybe the handle is the wrong way to go for this specific task... I'm instead using a physics constraint, which ought to be a more effective solution.

            Now, I have a really interesting problem here, and one I can't quite pin down.

            The ragdoll is connected to the capsule via a constraint to its torso bone, which works...
            Click image for larger version

Name:	RagdollbyCapsule.png
Views:	1
Size:	145.5 KB
ID:	1056363

            ...until the asset is told to blend back into animation and stop simulating physics, at which point it utterly explodes...
            Click image for larger version

Name:	Meshsplosion.png
Views:	1
Size:	122.9 KB
ID:	1056365

            ...and then reassembles itself in the incorrect position where it began its ragdoll.
            Click image for larger version

Name:	AndNowWeBrokeIt.png
Views:	1
Size:	126.3 KB
ID:	1056367
            Attached Files

            Comment


              #7
              Never mind, this is resolved. The problem is, Unreal seems to be incorrectly determining location and rotation when told to "Reset Relative Transform".

              By breaking the constraint and then telling Unreal to set the WORLD transform of the skeletal mesh to the capsule's transform, offset by its own relative transform, it works just fine. This is probably a bug, which I'll report on the answerhub.

              Comment


                #8
                do you have an example blueprint ?
                Mods: NPC Bush Peoples V6


                Comment


                  #9
                  Originally posted by RhythmScript View Post
                  This doesn't seem to do anything, alvarofer. I must be doing it wrong, can you see where my mistake is?

                  [ATTACH=CONFIG]10888[/ATTACH]
                  Pic related is the BP I'm using. As far as I can tell, this should work, right? I have a physics handle component on my pawn (attached at the root like a movement component, which I can't change). When I trigger the ragdoll, the whole skeleton simulates physics. Then, I attach the handle to the bone I want to "carry" using (which in this case is a reference to a bone called SpinalBase which I'm pulling from somewhere else). Then I use a timeline to tick the location of the handle using set target loc and rot, which is fed using the pawn's capsule.

                  The end result SHOULD be that the mesh goes full ragdoll, but the torso is attached to the capsule and moves with it, with the rest of the ragdolling mesh being carried behind. Right?

                  But in practice...
                  [ATTACH=CONFIG]10889[/ATTACH]
                  the skeletal mesh remains stationary and crumbles into a heap, completely ignoring the position and rotation of the actor's capsule.
                  Could you post more picture of your blueprint? I'm trying something similar, but I'm a newbie.

                  Comment


                    #10
                    Can you post an example of your use of the Physics Constraint-based approach? Is the Capsule Component that your ragdoll is following part of the Player Pawn, or is it just another Actor in the Level?
                    I'm trying to assign and unassign a Physics Handle's Constraint Components via Blueprint (attach to a VR hand and let go) and I'm getting null Actors and warnings about not being in the same scene.

                    Comment

                    Working...
                    X