Simple animation and then resume idle/walk/run

Hi! I’m sure this one will be an easy one :slight_smile:

So what I am attempting is to make a character pickup a ball on the ground. I have started off by using the 3rd person game template.

So I created the ball and put a box trigger around it. I set up an event in the level blueprint that handles when my character overlaps with the balls trigger sphere, so it pops a message on the HUD saying “Press F to Pick Up”. From here, I need to make it so when the character is within the trigger sphere AND presses F it will play the ‘Pick Up’ Animation Sequence I’ve created.

In my efforts I’ve managed to get it working to the point where my character plays the animation, and then no longer returns to the idle/run/walk state and begins gliding around. But forget that I mentioned that, because I deleted all my attempted code for a fresh start.

So, my question is, what will I need to put in which blueprint to achieve this?

Just on a side note, please don’t link me to the set of youtube tutorials by Unreal Engine, because I assure you I have watched them - twice, and those tutorials are slightly different to what I’m attempting to achieve today, but is enough to throw me off. I’m new to UE4, and after following many tutorials I’m starting to be able to do stuff on m justy own now - just - this has me stumped :stuck_out_tongue:

I intend to make the character throw the ball afterwards, but I should be able to work that out for myself after I get the pick-up working.

Thanks in advance for any help :slight_smile:

Okay! I think I understand. Let me put it in my own words: I set up an input for the ‘F’ key. In the level blueprint, I create the event that handles when the F key is pressed. That event will essentially get my character, set a variable defined in my character ABP (lets call it ‘doPickUp’) to true, and then over in my ABP at the end of my eventUpdateAnimation event (i’ve got a few other things setting speed and what not) so on the end of that chain, I have a branch to check if doPickUp is true, if it is, play pickUp animation montage?

Does everything sound right there?

You almost always want your ABP (animation blueprint) to handle your animation needs. Assuming that picking something up is a full body animation (as in it should override all other animations for it’s duration) simply convert it to a montage (right click in Content Browser → Convert to Montage). Then when your pickup event happens set something to let your ABP know that you should be play that animation. Then in your ABP check that variable (or however you want to set that notify up) and play that montage.

I just answered another question that’s rather similar, if you want to see more options here’s that question: Different Reload Animations for Different Weapons - Character & Animation - Epic Developer Community Forums

Pretty much, just be sure to unset whatever variable you’re using so you don’t constantly call play. While you can set variables directly in the ABP I’d suggest going through the TryGetPawnOwner.

Depending on the complexity of your project here’s a thorough setup:
Pawn has the var ‘isPickingUp’ that is set to true when you successfully start the pickup process

ABP per tick:

  1. Has a reference to the Pawn from TryGetPawnOwner and if Local_isPickingUp == false and isPickingUp== true play the montage.
  2. Update Local_isPickingUp to equal the Pawn isPickingUp

Add an event notify towards the end of the Montage that triggers PickupSuccessful
Have that event then tell the Pawn you successfully picked up (add to inventory or whatever and set isPickingUp to false)

Alternatively you could make IsPickingUp a state in your AnimGraph. What to do mostly depends on the specifics of your animations and how you want to handle interrupt-ability. The above suggestion allows isPickingUp to be checked while pressing other keys, for example if you didn’t want the player to jump while picking something up you could check that variable before doing anything with that consumed input. Alternatively, you could stop the montage, update isPickingUp, and your notify wont get called so you will have successfully interrupted picking your thing up.

Thanks for the reply!
It’s very interesting to see the different ways you can go about doing the same thing. Right now I’m at work, but i’m excited to get home and attempt to implement this.

I think I will attempt the first method you suggested. I’ve got to brush up on montage notifies, but it seems quite straight forward. I’m going to choose this approach, because in the same code block that the notify calls is where I can handle the attaching of the ball to the hand socket.

Now there is something that I didn’t quite understand (being new sucks) but you referenced Local_isPickingUp, which is confusing. Are isPickingUp and Local_isPickingUp different? Are they two seperate variables? Meaning I should create a variable in the ABP called Local_isPickingUp, and that variable is getting set from calling a GET isPickingUp when referencing the pawn?

Depressingly, I attempted to implement this, and I couldn’t get it to work. This is my level blueprint that handles the keyboard input. It is setting F Pressed which is defined in my ThirdPersonCharacter BP to true, when F is pressed and it is inside the collision box http://i.imgur.com/CjzY5fs.png?1

This is my ThirdPersonCharacter Anim BluePrints event graph. http://i.imgur.com/jFVXV4h.png?1

I thought that if this was to work the montage would play.

Can you spot what I’ve done wrong??

Update: I’ve gone for the second option that you mentioned above, and now everything runs perfectly! Thank you for all your time and effort IanLaBrie, you’ve done me a tremendous solid.