# How can I play animations strictly from C++?

**URL:** <https://forums.unrealengine.com/t/how-can-i-play-animations-strictly-from-c/330140>\
**Category:** Character & Animation\
**Tags:** unreal-engine, CPP, question\
**Created:** [August 27, 2015, 10:51pm UTC](https://forums.unrealengine.com/t/how-can-i-play-animations-strictly-from-c/330140 "2015-08-27T22:51:58Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![KingCole32](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KingCole32](https://forums.unrealengine.com/u/KingCole32)\
**Post date:** [March 7, 2017, 6:09am UTC](https://forums.unrealengine.com/t/how-can-i-play-animations-strictly-from-c/330140/21 "2017-03-07T06:09:29Z")

</div>

It’s been a while since I’ve looked at this, as I got moved to a different project, but it seems like I remember seeing a method of casting a blendspace as an anim sequence, which can be played from slots…?

Again, the details are foggy and I know I never got it to work properly (I could play a one-off blendspace via code, but it was full-body and, worse, wouldn’t return back to the default anim), so I can’t make any promises. Might take a look again soon, though.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_adf007c3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_adf007c3](https://forums.unrealengine.com/u/anonymous_user_adf007c3)\
**Post date:** [September 26, 2017, 12:37pm UTC](https://forums.unrealengine.com/t/how-can-i-play-animations-strictly-from-c/330140/22 "2017-09-26T12:37:41Z")

</div>

I find that this way montage and blend space are exclusive. You won’t be able to play montage in c++ after you play blend space in c++. I tried to call SetAnimationMode, it works. but you lose the blending (transition between the two). Any ideas?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2a566616](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2a566616](https://forums.unrealengine.com/u/anonymous_user_2a566616)\
**Post date:** [November 8, 2017, 10:50pm UTC](https://forums.unrealengine.com/t/how-can-i-play-animations-strictly-from-c/330140/23 "2017-11-08T22:50:14Z")

</div>

@wren945 perhaps you can try and have two different states, the default one being your blend space, and transition to the state that handles the montage when needed, and transition back when the montage stopped playing

 ![219572-3-fsm-states.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/c/c2cabf6bd3b3994e066dbde34f92cce93966199e.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_adf007c3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_adf007c3](https://forums.unrealengine.com/u/anonymous_user_adf007c3)\
**Post date:** [March 23, 2018, 10:33am UTC](https://forums.unrealengine.com/t/how-can-i-play-animations-strictly-from-c/330140/24 "2018-03-23T10:33:54Z")

</div>

Thanks. But aren’t we talking about controlling animation “strictly from c++”. 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_adf007c3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_adf007c3](https://forums.unrealengine.com/u/anonymous_user_adf007c3)\
**Post date:** [March 23, 2018, 10:37am UTC](https://forums.unrealengine.com/t/how-can-i-play-animations-strictly-from-c/330140/25 "2018-03-23T10:37:30Z")

</div>

I find the animation transition is mess up if I do it this way. When you switch animation (montage) quickly, they won’t transit well. The cross fade just doesn’t work. If blend in and blend out time of 2 subsequent animation montages is different, the cross fade is crewed up.

---

<div class="post-metadata">

**Author:** ![fdcumt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fdcumt](https://forums.unrealengine.com/u/fdcumt)\
**Post date:** [May 1, 2019, 12:39am UTC](https://forums.unrealengine.com/t/how-can-i-play-animations-strictly-from-c/330140/26 "2019-05-01T00:39:31Z")

</div>

hi @room101, thanks for your answer, but I still have some puzzled, where the code be called, and what the type oCreature, now I use the UE4.22.

[Previous page](https://forums.unrealengine.com/t/how-can-i-play-animations-strictly-from-c/330140.md?page=1)
