# How to use a keyboard input for state machine transition rule?

**URL:** <https://forums.unrealengine.com/t/how-to-use-a-keyboard-input-for-state-machine-transition-rule/463617>\
**Category:** Character & Animation\
**Tags:** Input, unreal-engine, transition, question\
**Created:** [April 11, 2020, 1:54am UTC](https://forums.unrealengine.com/t/how-to-use-a-keyboard-input-for-state-machine-transition-rule/463617 "2020-04-11T01:54:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon3682225](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon3682225](https://forums.unrealengine.com/u/anon3682225)\
**Post date:** [April 11, 2020, 1:54am UTC](https://forums.unrealengine.com/t/how-to-use-a-keyboard-input-for-state-machine-transition-rule/463617/1 "2020-04-11T01:54:05Z")

</div>

(E.G Transition to the next animation when space bar is pressed down/is released)

---

<div class="post-metadata">

**Author:** ![ViceVersa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ViceVersa](https://forums.unrealengine.com/u/ViceVersa)\
**Post date:** [April 11, 2020, 6:17pm UTC](https://forums.unrealengine.com/t/how-to-use-a-keyboard-input-for-state-machine-transition-rule/463617/2 "2020-04-11T18:17:12Z")

</div>

In your blueprint for your character  
Make a Boolean variable I’ll call it SB  
Event space bar Pressed \> set SB to true  
Space bar released \> set SB to false

Animation blueprint event graph  
Event update animation:  
Get controlled pawn (or owning player whatever it’s called) \> cast to playerBlueprintName\> drag out the blue pin and Get SB \> right click the red pin and promote to variable (I’ll call it AnimSB)

In the anim graph click the transition rule between the animations and plug AnimSB to the canEnterTransition pin

I made a bunch of animations on the character animation tools a few years ago that can probably help you a lot  
[Https://YouTube.com/vic3vers4games](Https://YouTube.com/vic3vers4games)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_15d94937](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_15d94937](https://forums.unrealengine.com/u/anonymous_user_15d94937)\
**Post date:** [April 14, 2022, 2:29am UTC](https://forums.unrealengine.com/t/how-to-use-a-keyboard-input-for-state-machine-transition-rule/463617/3 "2022-04-14T02:29:20Z")

</div>

dude thank you so much really useful
