Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

setting up ragdolls for death ..

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

  • setting up ragdolls for death ..

    OK, Here's one I'm stumped on. Trying to ragdoll on death, without taking the entirety of UTPawn with it. What I've managed to cobble together is working perfectly, in fact, amazingly beautifully, for explosive projectiles .. but not at all for instant hit weaponry.

    When I kill one of these pawns using a rocket launcher, it flies magnificently through the air, and impales itself on one of the many features of the level, and it looks fantastic. When I kill one of them using an instant hit weapon, about 1 out of every 12 fall to the ground in the fetal position, and all the rest simply jump backward about one step, and freeze in the air.

    Code:
        mesh.MinDistFactorForKinematicUpdate = 0.f;
    
        InitRagdoll();
        Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE);
        Mesh.SetRBChannel(RBCC_Pawn);
        Mesh.SetRBCollidesWithChannel(RBCC_Default,TRUE);
        Mesh.SetRBCollidesWithChannel(RBCC_Pawn,TRUE);
        Mesh.SetRBCollidesWithChannel(RBCC_Vehicle,TRUE);
        Mesh.SetRBCollidesWithChannel(RBCC_Untitled3,FALSE);
        Mesh.SetRBCollidesWithChannel(RBCC_BlockingVolume,TRUE);
        Mesh.ForceSkelUpdate();
        Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
    	Mesh.PhysicsWeight = 1.0;
    	Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE);
    	Mesh.bUpdateKinematicBonesFromAnimation=false;
    	mesh.bPauseAnims=True;
    
    	Mesh.SetRBLinearVelocity(Velocity, false);
    
    	mesh.SetTranslation(vect(0,0,1) * 6);
    	Mesh.ScriptRigidBodyCollisionThreshold = MaxFallSpeed;
    	Mesh.SetNotifyRigidBodyCollision(true);
    	Mesh.WakeRigidBody();
    	ApplyImpulse = vect(0,0,1) * 1500;
    	mesh.AddImpulse(ApplyImpulse, hl, , true);
    The Physics documentation is absolutely no help at all.

  • #2
    I had that issue as well. I will have to go through my change logs and see what I did to fix it. I had it making my T-pose instead of going to ragdoll, lol. I'll get back with you on this.

    Comment


    • #3
      Ok, from what I can tell, your pawn isnt being told to ragdoll in the correct physics state and it's bypassing being told to ragdoll properly, or at least this was my problem. I fixed it by forcing ragdoll and the correct physics state during death:

      Drop this in your pawn class...
      Code:
      function SetDyingPhysics()
      {
      	if( Physics != PHYS_RigidBody )
      	{
      		SetPhysics(PHYS_RigidBody);
      		ForceRagdoll();
      	}
      }
      give it a shot and see if that helps any.

      Comment


      • #4
        ForceRagdoll just calls FeignDeath .. which i'm trying to avoid having to copy the -entire- feign or playdeath parts out of utpawn to deal with, because they are totally tied up into everything else in utpawn.

        InitRagdoll at the top of my function is a native function that does the physics setup (it doesn't change if I do it manually, either, it works identically) .. i just can't figure out why it is that they would be freezing after a frame or two with instanthit weaponry doing the damage, versus rocket launcher doing the damage.

        Comment


        • #5
          Aren't the instant hit weapon trying to call another death trigger?

          Comment


          • #6
            no, all damage goes through TakeDamage(), which eventually calls PlayDying(), which is where this code is (also the same place it is triggered from UTPawn).

            I'd be happy if they just crumpled into a heap on the floor .. but that's not the case, they are actually freezing.

            hmm. update. just tried it with the shockrifle, and it works with the shockrifle. sometimes it fails, with the link gun projectile, though. this is curioser and curioser.

            Comment


            • #7
              Do you have/set "KDamageImpulse" and "KDeathUpKick" with hight values before to enter in playdying?

              Comment


              • #8
                The KDeathUpKick isn't used in the above code, it's just a straight vector vect(0,0,1500) applied. I started with it at 100, that worked exactly the same as it's working at 1500, and also the exact same when I gave it 100K.

                I expect that I should be able to just do the first two lines in that code , and it -should- ragdoll .. but it doesn't. And there's no documentation whatsoever on what is actually needed TO do it ..

                Comment


                • #9
                  And what happens if you comment out

                  mesh.bPauseAnims=True;

                  ?

                  Running your code, commenting that out ( and I added some stuff in from Epic, most of this is stuff I haven't looked at yet )

                  Code:
                  simulated function PlayDying(class<DamageType> DamageType, vector HitLoc)
                  {
                    local vector ApplyImpulse, ShotDir;
                    
                    bReplicateMovement = false;
                    bTearOff = true;
                    Velocity += TearOffMomentum;
                    SetDyingPhysics();
                    bPlayedDeath = true;
                    HitDamageType = DamageType; // these are replicated to other clients
                    TakeHitLocation = HitLoc;
                    if ( WorldInfo.NetMode == NM_DedicatedServer )
                    {
                      GotoState('Dying');
                      return;
                    }
                    InitRagdoll();
                    mesh.MinDistFactorForKinematicUpdate = 0.f;
                    
                    if (Physics == PHYS_RigidBody)
                    {
                      //@note: Falling instead of None so Velocity/Acceleration don't get cleared
                      setPhysics(PHYS_Falling);
                    }
                    PreRagdollCollisionComponent = CollisionComponent;
                    CollisionComponent = Mesh;
                    if( Mesh.bNotUpdatingKinematicDueToDistance )
                    {
                      Mesh.ForceSkelUpdate();
                      Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
                    }
                    if( Mesh.PhysicsAssetInstance != None )
                      Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE);
                    Mesh.SetRBChannel(RBCC_Pawn);
                    Mesh.SetRBCollidesWithChannel(RBCC_Default,TRUE);
                    Mesh.SetRBCollidesWithChannel(RBCC_Pawn,TRUE);
                    Mesh.SetRBCollidesWithChannel(RBCC_Vehicle,TRUE);
                    Mesh.SetRBCollidesWithChannel(RBCC_Untitled3,FALSE);
                    Mesh.SetRBCollidesWithChannel(RBCC_BlockingVolume,TRUE);
                    Mesh.ForceSkelUpdate();
                    Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
                    Mesh.PhysicsWeight = 1.0;
                    Mesh.bUpdateKinematicBonesFromAnimation=false;
                    // mesh.bPauseAnims=True;
                    Mesh.SetRBLinearVelocity(Velocity, false);
                    mesh.SetTranslation(vect(0,0,1) * 6);
                    Mesh.ScriptRigidBodyCollisionThreshold = MaxFallSpeed;
                    Mesh.SetNotifyRigidBodyCollision(true);
                    Mesh.WakeRigidBody();
                    if( TearOffMomentum != vect(0,0,0) )
                    {
                      ShotDir = normal(TearOffMomentum);
                      ApplyImpulse = ShotDir * DamageType.default.KDamageImpulse;
                      // If not moving downwards - give extra upward kick
                      if ( Velocity.Z > -10 )
                      {
                        ApplyImpulse += Vect(0,0,1)*2;
                      }
                      Mesh.AddImpulse(ApplyImpulse, TakeHitLocation,, true);
                    }
                    GotoState('Dying');
                  }
                  And bots added through script die a nice disgraceful sack of potatoes death each time. ( I haven't noticed them not do it with that code, but yours wasn't working with projectile fire all the time, it seemed quite a few got stuck.. almost like their anims were paused . )

                  Give it a shot, It's a bit above my head ATM, but I can try other things.

                  Comment


                  • #10
                    Without the Mesh.bPauseAnims, I can see some of their bones playing animations still after they've frozen (even with the PhysicsWeight at 1.0).

                    Yeah, I was trying to isolate which parts of the UT code were actually necessary to get this to work all the way .. without all the extra UT junk that I don't want (like the ugly shotstrength thing that they've been using since the first Karma ragdoll implementation) .. If your code works, Wizzard, which I'll check when I get back to my desktop in a couple hrs, then I can hopefully find out exactly which parts are necessary .. then we'll have another resource for everyone

                    Update: Wizzard's code works, awesome. After I do some playing with the other stuff I'm prototyping, I'll see if there's anymore bits of that that I can get out of there.

                    Comment


                    • #11
                      Glad that worked. Tested it quickly in MP and it doesn't appear to replicate. I'll have a look through tonight and see if I can find out why.

                      Comment


                      • #12
                        That, I didn't have a problem with. Perhaps your PlayDying isn't being called on your clients for some reason?

                        Comment


                        • #13
                          Could be. Haven't played with a lot of it yet. Probably missed something stupid.

                          Edit:
                          Checked, and Tornoff is called, so is PlayDying ( on both client and server )..

                          I'll have to review why the client won't execute the code, just the server.

                          Guess this is important.
                          PhysicsAsset
                          in the Mesh setup

                          Comment


                          • #14
                            Wizzard's code works great to fall over, but I'm noticing that the pawn falls through the brush floor. Any ideas what might be causing this to happen?

                            Comment


                            • #15
                              way to gravedig, but this is a useful thread, so heres why

                              you havent set the correct RBCollision channels on the pawns when they die. heres the list: http://wiki.beyondunreal.com/UE3:Pri...llisionChannel

                              Comment

                              Working...
                              X