Announcement

Collapse
No announcement yet.

RagDoll LifeSpan question

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

    RagDoll LifeSpan question

    When a pawn dies, it goes to the Dying state and LifeSpan is set to RagdollLifeSpan. In the BeginState function it calls the Timer event like so:

    Code:
    SetTimer(2.0, false);
    LifeSpan = RagDollLifeSpan;
    As far as i can tell, the Timer event just keeps looping through to see if the Pawn can be seen. If it can't, it destoys it. I'm looking for the event thats called AFTER RagDollLifeSpan has ran out, which i guess would call Destroy(), but I can't see where the timer for that gets started.

    Am i missing something here?

    I want to stop the pawn being destroyed when it's in the air (caused by an impulse). I only want the pawn to be detroyed when it's been stationary for a few seconds AND RagdollLifeSpan has elasped.

    Thanks

    #2
    You can code your own dying circumstances for your pawn, and just make him fall into ragdoll.

    Comment


      #3
      LifeSpan is checked natively and once it reaches a zero (negative value or quite near to zero), the actor gets destroyed.

      Code:
      // How old the object lives before dying, 0=forever.
      var float LifeSpan;
      Just set LifeSpan to 0, remove the timer and control when you want to remove the ragdoll (for instance on Bump/Landed; closed to zero velocity, etc.).

      Comment


        #4
        Thats great thanks. I did almost exactly what you said RattleSn4k3. In the Dying State I over wrote the Tick function. I removed that stuff about the BioKill and put this:

        Code:
          if( Velocity == vect(0,0,0) && WorldInfo.TimeSeconds - AccumulationTime > MyRagDollLifeSpan)
        	{
        	//Fade it out now.
                     Destroy();
        	}
        The problem is sometimes my enemy pawns land awkwardly and they shake/wobble a bit and Velocity NEVER reaches 0, so they never destroy.
        Any tips/hints on this please?
        I want them to fade out nicely. I guess I could leave their Ragdoll Timer in but extend it as a failsafe, but again as it's native I'd never be able to tell it to fade out before it's detroyed.
        Thanks

        Comment


          #5
          Instead of checking for the vect(0,0,0) value, you could set a threshold of how fast the actor should move before trying to destroying it.
          VelocityThresholdForDying could be something like 20.
          Code:
          if (VSize(Velocity) < VelocityThresholdForDying && ...

          You can fade it out, just create a custom timer which will initial the fade (set parms on the material of the mesh, re-scale, etc.).
          Such fade effects exist in the UT3 codebase (UTDmgType_BioGoo::DoCustomDamageEffects for instance).
          Code:
          LifeSpan = RagDollLifeSpan;
          SetTimer(LifeSpan-FadeDuration, false, 'FadeOutDeadMesh');

          Comment


            #6
            Do i HAVE to set up a MIC to get the fade to work or can i just add the Scalar parameter in my standard material?

            cheers

            Comment


              #7
              You can use your own instanced material as well, yes.

              Comment


                #8
                Unbelievably, I've managed to code the fade working correctly. However, one slight issue. I've had to change the material Blend Mode from Opaque to Translucent. Now I've got a weird alpha sorting issue where it tries to draw polys towards the back of the pawn at the front. Any tips on this please?

                Cheers

                Comment


                  #9
                  There is Translucency Sort priority in meshes....

                  Comment


                    #10
                    translucency sorting is one of the Achilees Heel's of modern engines. the most you can try is the material checks 'Enable Separate Translucency', 'Use lit Translucency Depth Pass', and 'Use Lit Translucency Post Render Depth Pass'
                    if none of that works you might want to consider using ScreenDoorFading instead. to use this just enable 'Used With Screen Door Fade' in your material, and instead of blending the alpha of your material simply hide the actor from code and it will "dissolve" into disappearing

                    Comment


                      #11
                      Thanks. When you say hide the actor in code, do you mean SetHidden(True); ? Cuz i've tried that with ScreenDoorfading ticked in the material and it doesn't fade out.
                      cheers

                      Comment

                      Working...
                      X