Animation with Keyboard Input

Hi so my plan for my character is to press “L” on the keyboard he would go into his “From standing to laying down on the ground” animation. Once that animation is done then he would transition into a laying Idle loop. Then when I press “L” whenever during the idle loop he would go into a standup animation and be able to move again. That’s my objective. It’s somewhat similar to press a keyboard button to a crouch then plays crouch idle with no movement, then press same button and stands up and able to move around again.

I’ll attach photos but for what I’ve done trying to figure this out is set a FlipFlop for input action “L”. From the FlipFlop (A) leading to event laydown and (B) leading to event standup. In the laydown event I can get the character to laydown animation but I have no idea how to transition to laying down idle that loops. Also if I were to press “L” again I can get the character to stand but only if i put a variable Bool 'IsStanding" but I can’t seem to get his movement back after he’s standing he just moves around with NO movement animations.

Have a look at the images please, I understand if things aren’t closely correct and there might be an easier way I can’t see. I’m also new and more of a 3d artist broading my horizons. I would appreciate all the help I can get. The AnimBP of the layingdown, IdleLoop and Standup of the pic is in a State that is connected to my Movement State as seen in the other pic. Let me know if I didn’t explain properly and thanks for any help.

I’ve Uploaded
AnimBP-EventGraph
AnimeBP-State
CharacterBP-Input
CharacterBP-Event 1 with ISLaying
and another with ISStanding added

So, you are setting variable on the events, but what happens if the event is called and you aren’t stating or laying down?
problem number 1) put everything in a true branch based on the proper boolean.
Aso you aren’t resetting the other boolean so, the character is now both standing and laying down. Ergo the error.

First.
Delete the events. Entirely useless.

Second, set up at the end of the flip flop with both bools on each branch.
Make sure that when one is enabled the other is disabled.

in fact, let’s proceed them with some error prevention:

if standing up, lay down standup bool has to be false to proceed.
then set standup to false and laydown to true.

if laying down, standup bool has to be false to proceed.
Then set laydown to false and stand up to true.

Next
create an animation for laying down that takes you from standing to laying down
Create the reverse of that for standing up.

Next,
the state controller for this should be
idle > lay down start > lay down idle > lay down up > idle.
Drive the down start with the end of the animation and disable looping.
drive the get up to idle with the end of the animation and disable looping.
Obviously drive lay down start with the bool And get up with the same bool becoming False.

Next.
In the animations you just created (for laying down) add a notify for DisableMovement (call it just that).
In anim BP call in the notify and use that to disable movement.
Likewise on the standin up animation create an EnableaMovment notify.
use that notify to call in the walking movement.

That should pretty much be all you need.

Thank You for replying back to me!

So I got rid of the events and from your advice I put together what came to my mind. Which I think I’m off from your instructions. Starting off with the results my character can from pressing “L” “Stand to Laydown” animation works, while lying down the “LaydownIdle Loop” anim doesn’t work probably because I have no function lol, but a combination of the end result of the “stand to laydown” and idle are working at the same time when “laydown Idle” should be activated. Then when I press “L” “Laydown to Stand” anim works but at the end of the anim a combo of that and idle are working at the same time. I can’t continue to walk after the animationis done but if I press Spacebar for jump the character can do that action and others but instantly loops to “laydown to Stand” Anim.

Of course my animation moves around since I haven’t set up the DisableMovement on “stand to Laydown” anim Notify and set EnableMovement for “laydown to stand” Notify. I’m really not sure how that’s done in the AnimBP. I’m also hoping I put the Anim Notifies in the correct spot.

Hopefully I’m closer lol thank you again!

Here’s some Images of my some what corrections

Ok. No.
you didnt understand what I was saying about the booleans.
that’s the biggest issue.

First of.
The branch being always true with the checkmark means that I can never be false.

You need to link the Get variable of standing up to the branch in flip/flop a. And the variable of laying down in the branch of flip/flop B

then it will actually be useful and perform a check before setting the variables.

Second, if you are standing up (true) you are not laying down (false). Those are mutually exclusive. Right? Right.

so connect one set exec pin to the other and set both.

it doesn’t matter where the anim notifies are, you just drag the character casting pin and create a variable / set it by connecting the exec pins.
Then you can drag that variable by the notifies and call the proper functions inside of anim BP.

Last, but also important.
you arent ever exiting your laydoenidleloop.
you need to connect that one to the standing up.
And standing up needs the same “nothing” as the other one has going into the laying down idle.

Makes sense?

Thank You for the reply again!

Yeah I’m still not understanding something is going way over my head I’m rethinking my intelligence lol. Results this time pressing “L” “Laydown” Anim works and doesn’t move. I set a transition duration from “laydownstart” State to “laydownIdle Loop” and it works. Trying to press “L” for standingup doesn’t work lol.

I have a feeling I’m messing up with the Bools. I might need a diagram lol

Thank you for the instructions I really appreciate it!

Thank You so much MostHost LA,

I ended up achieving my goal with lots of your help. The last part I was have problems with I was fiddleing around all day with it and eventually I got what you were getting at. If there is anyone who is looking for something similar to their character, first major gratitude to MostHost LA, second I’ll post my pics of the graphs to achieve this.

Results this is for Input Action with Animation transitioning to an Anim Loop and then pressing same InputAction for different Anim and being able to continue with movement.

If there are any suggestions for the Standup state connection to Idle. I wrote it on the Picture but for the time remaining ratio <0.1, I had to in details under Blend Settings>Duration i set it to the length of my standup anim for my character to transition to idle and be able to move around again correctly. If I am incorrect let me know but I still posted this because it still works.

Ok, not quite there.
Attach the booleans to one another

You can even remove the False part of branch. if the key is false nothing should happen. it’s just some extra error checking.

For the anim bp transition, instead of forcing a duration (which you may still need to do, but 3 is a lot?) use this in the transition
AnimBPTimeRatio.png

For the getting up something like this

You can replace the top bool with the time remaining. realistically the bool is extra you should not need to check it.

In fact, realistically checking 2 bools with up/down is superfluous. you can totally manage everything off just 1 bool in the animbp

If is laying is true start, get into idle, if it becomes false, exit idle, transition back to standing.

When the multiple bools become useful is if you want to go into crouch, or any other state. in that case you just connect the state machine for the idle to a different getting up animation that leads to the different state, and you get into that state by checking that the correct bool was activated.

All that said. I find it better to handle movement this way:


As you can see I’m cutting out user input based on a Boolean. this allows me to stop the character but still allow the player to look around. it comes in handy in advanced game play programming.

In the end a full state-machine looks something like this - and it’s still missing some vital stuff that’s relevant to my project. namely the flying/parachute states…

Awesome thank you!

Definitely simplified it way down to 1 boolean and it works perfectly. Great advice for Time remaining ratio’s as <= because I was using < and <= smoothed the transition slightly were it did matter. Having just IsLaying made it not only more cleaner but way easier to work with, now that it’s a flipflop(A) set Islaying True and flipflop(B) set IsLaying False like i said before way more simplified.

thank you for everything, everything works perfectly and I was able to set that the characters head can still move throughout the 3 anims aswell.