Make player stop moving after landing?
I've read numerous examples of how to apply force to a character, stop their movement, etc. None of the blueprints work for what I'm trying to do. I've tried them all, & tried making my own, no success. :(
Let me explain: My character's "landing" animation makes him pause for about a short moment, then resume the "run" animation after the landing recovery.
The default 3rd person character controller, by default, does not take into account any sort of "landing recovery." It just continues allowing movement with full velocity after a jump, no slowdown or pause whatsoever.
Unfortunately, the "recovery pause" I've made in my character's Animation Blueprint does not apply to his actual acceleration/velocity, so even though is animation looks "paused" the character can still move around. Essentially he's sliding over the ground after landing. His feet are not moving (as he's recovering from the jump) but his body continues to move forward anyway. It looks very strange and I can't progress forward until I figure this out.
The part of the "recovery" animation where the feet touch the ground occurs at the animation's 36% duration point. I've tried using adding nodes in the Animation Blueprint to detect this duration, and then use the "Stop Player Movement" node once it's detected. This never seems to take any effect though. I'm starting to suspect player movement can not be changed via an Animation Blueprint - is that correct?
I can add a similar setup to the character blueprint instead, but that blueprint does not give me access to the "recovery" animation's "duration" node. So I have no way of timing the stop/start of character movement with it.
Thank you very much for the help, sorry if my explanation was a bit confusing. I'm not a coder, just a visuals guy, so this stuff really stumps me.
asked Apr 11 '14 at 09:29 PM in Blueprint Scripting
Disclaimer: I'm an animator and even to me this seems hacky :), but it seems to work. I'm sure someone will post a much cleaner, better solution, but for now, here goes....
First, I added two anim notifies to my landing animation. One called StopMoving where the feet hit the ground and one called StartMoving at the end of the anim to allow the character to get going again. When StopMoving fires, I set the MaxWalkSpeed to 0. Then, when StartMoving fires, I set the MaxWalkSpeed back to it's normal value. What my eventGraph looks like:
Note that I'm storing the default MaxWalkSpeed in a variable at the top when the animation initializes and then using that variable to reset the MaxWalkSpeed after the anim finishes.
Hope that helps!
answered Apr 11 '14 at 10:06 PM
Ray Arnett STAFF
I don't know how to get the time from the animation because I don't really know how to use that. But I can tell you how to achieve this in blueprint if you can specify the recovery time yourself.
Edit your character blueprint. Add 3 variables to it: - CanMove (boolean) - RecoveryTime (float) - RecoveryElapsed (float)
Add an EventTick event and plug it to the following node graph: This will basically: - check if player is recovering (CanMove = false) - add the time elapsed since last frame to the total time recovered - if the time waited gets above the RecoveryTime it will reset CanMove to true to let the player move again
Now to stop your character from moving modify your movement input sections to first check that CanMove is true before changing player's position: Do that for movements and jump too and any input you want to block.
Now the only thing missing is to actually tell the player to stop moving when he lands. So add an Event On Landed node and from it set the CanMove variable to false: http://puu.sh/84YE7.jpg
That's it :)
answered Apr 11 '14 at 10:05 PM
I've just found out about three nodes which may help you - Set Ignore Move Input, Set Ignore Look Input and Reset Ignore Input Flags (I work in 4.8.3). You will find screenshot in the topic below:
PS Sorry, I didn't notice it's such an old topic.
Follow this question
Once you sign in you will be able to subscribe for any updates here