Download

AnimTree play anim for only specific bones

I’d like to add some “flinching” animations for when my human pawns take hits from bullets.

I know i can use an AnimNodeBlendPerBone and plug that into an AnimSlot that I can play the anim on. But doing that this way makes me select a bone and will play the animation from that bone to all of is children. So I i select the bone to be say Spine3, it will play on all bones branching from Spine3 (so arms, neck, head, etc). I only want to play the anim on a few select bones, and not have it branch out to all it’s child bones.

Anyone know how to do this?

Thanks

Hello mate.

You are trying to do hit reaction animations, like if the pawn gets hit on the hand, will play an injured animation? If this is what you want to do, you can do like I have done.

I know you are way more experienced than me on Unreal Script, however, I like to share what I know of Unreal Script, even if it is just a little knowledge.

I use the HitBone function inside the take damage event of the pawn to detect what bone was hit, then play an animation on the FullBodySlot (I am using default UDKAnimTree):


    local name HitBone;
    HitBone = Mesh.FindClosestBone(HitLocation);

      if(HitBone == 'b_LeftToe' || HitBone == 'b_LeftAnkle' || HitBone == 'b_LeftLeg' || HitBone == 'b_LeftLegUpper')
      {

       TopHalfAnimSlot.StopCustomAnim(0.15);

      `Log("Left Leg Hit Impact Damage");

       FullBodyAnimSlot.SetActorAnimEndNotification(true);
       FullBodyAnimSlot.PlayCustomAnim('hit_left_leg_UT3', 1.0, 0.35, 0.75, false, true);

       Super.StopFire(1);
       //here we set a very small ammount of ground speed to give an imperecptible ammount of movement for the pawn
       //using groundspeed 0 here will result on the bug of pawn falling down on the ground
       GroundSpeed=10;

       SetTimer(2.00,false,nameof(HitRecover));

      }

I don’t know if this is what you want, however, I just like to help whenever I can.

Thanks for the suggestion. What i’m really after is a way to play animations on an isolated bones, without that animation playing for all child bones.