# How to change animation with state machine?

**URL:** <https://forums.unrealengine.com/t/how-to-change-animation-with-state-machine/367296>\
**Category:** Character & Animation\
**Tags:** State-Machine, unreal-engine, UE4, Blueprint, question\
**Created:** [August 16, 2016, 11:56am UTC](https://forums.unrealengine.com/t/how-to-change-animation-with-state-machine/367296 "2016-08-16T11:56:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinaboyette](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kevinaboyette/32/469391_2.png) [@kevinaboyette](https://forums.unrealengine.com/u/kevinaboyette)\
**Post date:** [August 16, 2016, 11:56am UTC](https://forums.unrealengine.com/t/how-to-change-animation-with-state-machine/367296/1 "2016-08-16T11:56:57Z")

</div>

I read forum posts, I’ve watched videos, but I still can’t figure out a basic task.

All I want is my character to switch to a move-left animation when the A key is pressed, and a move-right animation when the D key is pressed (3D side-scroll strafing, basically)

Currently, the character moves with A/D, but stays in the idle animation.  
Can someone give me guidance?

 ![103052-bp+class.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/0/80079a7ca39ddbb0f4e9212b4a2c0cd19f5a006e.png)

 ![103053-anim+bp_eventgraph.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/0/2/702706e4a4887d1b0c3970e04a74f3593254012a.png)

 ![103054-anim+bp_animgraph.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/0/4208bfc4c325f82adde93fb72c39b4d63a4aa1a6.png)

 ![103055-anim+bp_animgraph2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/9/df904d58bab5d4b40c6b67b135bce96251d9dd3c.png)

 ![103056-anim+bp_animgraph3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/4/3/043223fd9938c2ec85b5f021e044a2baf14b66f5.png)

---

<div class="post-metadata">

**Author:** ![ScottSpadea](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scottspadea/32/1194682_2.png) [@ScottSpadea](https://forums.unrealengine.com/u/ScottSpadea)\
**Post date:** [August 16, 2016, 12:13pm UTC](https://forums.unrealengine.com/t/how-to-change-animation-with-state-machine/367296/2 "2016-08-16T12:13:39Z")

</div>

you need to use the variable from JimmyBP to set the variable within the animblueprint. right now, you are just setting the variables to themselves.

in the Jimmy\_AnimBP event graph, drag off the return value from the cast, and use those JimmyBP variables to set those animblueprint booleans.

---

<div class="post-metadata">

**Author:** ![kevinaboyette](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kevinaboyette/32/469391_2.png) [@kevinaboyette](https://forums.unrealengine.com/u/kevinaboyette)\
**Post date:** [August 16, 2016, 12:21pm UTC](https://forums.unrealengine.com/t/how-to-change-animation-with-state-machine/367296/3 "2016-08-16T12:21:16Z")

</div>

Thank you! Can’t believe it was such a simple solution.

---

<div class="post-metadata">

**Author:** ![kevinaboyette](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kevinaboyette/32/469391_2.png) [@kevinaboyette](https://forums.unrealengine.com/u/kevinaboyette)\
**Post date:** [August 16, 2016, 12:26pm UTC](https://forums.unrealengine.com/t/how-to-change-animation-with-state-machine/367296/4 "2016-08-16T12:26:41Z")

</div>

Here’s a screenshot of the adjusted Event Graph. Works perfect.

 ![103057-anim+bp_eventgraph2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/5/9/6590ec63e7db6e0af250be1cd8cec0383bd68d8c.png)
