[SideScroller Template] Adding Crouch animation

Ive added a crouch function to the standard Template char, but when i try to add an animation for this in the Blend Tree i get stuck, ive tried to add a variable (Booloen) thats “ChrouchPressed”, with a transistion that is actrivate and one who arent, but i cant seem to activate the “Crouch” animation (My logic was using a button as trigger (buttonDown) but cant find anything usefull in the input secion), here is a picture of my experimenting:

c930f05acebe1784ebe552727ff752d1ba764b3f.jpeg

Normally it works like that:

  1. add an event into your character blueprint - create a new bool variable (IsCrouching?) + change it to “editable” (in the details panel) - place two “set IsCrouching?” nodes into the event graph - connect them with the event - one of those set nodes should be on “true” and the other one on “false”
  2. now create a blendspace for the crouching animations -> just copy the walking/idle blendspace - delete all animations - change the speed value to a lower one - apply changes - add your crouching animations
  3. open the animation blueprint - add a “cast do mycharacter” node - drag out the blue link from it - search for “get IsCrouching?” and add the node
  4. create a new bool variable in the anim bp (IsCrouching?_Animbp) and add it to the graph
  5. connect the “get IsCrouching?” with the “set IsCrouching?_Animbp” + connect the “Is…_Animbp”
  6. now open the anim graph - add a new state - add a transition to the new state and back to the old state - add the “IsCrouching?_Animbp” variable to the transition from Idle/Run to the new state and a “not” + “Is…_Animbp” in the one from your new state the the old one

Also make sure to take a look at this tutorial: :slight_smile:

Hmm i am not totaly understandin this step:
5. connect the “get IsCrouching?” with the “set IsCrouching?_Animbp” + connect the “Is…_Animbp”

Could you take a screenshot?

Yep, wait a sec, my UE is currently updating… :smiley:

DUDE no need, it worked, mishmashed your video and your text, and it worked :smiley:

Sorry double post, how do i keep my char crouched if theres a “roof” above him? the animation quits when i let go of the key, but if i do that under a block he stands up, the game “acts” like he still crouched, but the animation pops back to idle (i got a “Walk while crouch” funtion in my prototype, so he will stop alot under stuff)

Ok, then instead of using your own “crouch bool”, use the one which already exists -> search for “is crouched” and do the upper steps from 2. (you dont need the 1st step anymore) :slight_smile:

Thanks alot, you realy helped out alot :slight_smile: