# How to play animation and destroy actor from BTTask?

**URL:** <https://forums.unrealengine.com/t/how-to-play-animation-and-destroy-actor-from-bttask/291392>\
**Category:** Character & Animation\
**Tags:** Behavior-Tree, bttask, unreal-engine, Blueprint, question\
**Created:** [August 19, 2014, 6:15am UTC](https://forums.unrealengine.com/t/how-to-play-animation-and-destroy-actor-from-bttask/291392 "2014-08-19T06:15:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_e332521e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e332521e](https://forums.unrealengine.com/u/anonymous_user_e332521e)\
**Post date:** [August 19, 2014, 6:15am UTC](https://forums.unrealengine.com/t/how-to-play-animation-and-destroy-actor-from-bttask/291392/1 "2014-08-19T06:15:13Z")

</div>

I set up a simple Behavior Tree, and I’d like to make a task that plays a death animation and destroys the actor.

However, I can’t even destroy the actor. The Destroy Actor node has no effect.

 ![13118-a.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/6/a/56a29f6cc9563d933556bbb73f34f1155413368a.jpeg)

How do I get animation blueprint from BTTask? I want to set a variable there, to signal it to play the death animation. Why doesn’t Destroy Actor have any effect in this task?

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [August 19, 2014, 10:13am UTC](https://forums.unrealengine.com/t/how-to-play-animation-and-destroy-actor-from-bttask/291392/2 "2014-08-19T10:13:58Z")

</div>

One thing you’re missing here, that causes your issues, is that `OwnerActor` in `EventReceiveExecute` is a `Controller` not a `Pawn`. So when you call destroy you don’t destroy the pawn on the level, you destroy his brain! 😃

To get access to `AnimInstance` of your AI you need a sequence of calls:

1. cast `OwnerActor` to a controller
2. from the controller get the pawn with `GetControlledPawn` call
3. cast retrieved pawn to `Character` class
4. from resulting character instance get its skeletal mesh with `GetMesh` call
5. you can get `AnimInstance` from the mesh with `GetAnimInstance` call

Cheers,

–mieszko

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e332521e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e332521e](https://forums.unrealengine.com/u/anonymous_user_e332521e)\
**Post date:** [August 19, 2014, 4:52pm UTC](https://forums.unrealengine.com/t/how-to-play-animation-and-destroy-actor-from-bttask/291392/3 "2014-08-19T16:52:06Z")

</div>

Works like a charm, thanks!  
I forgot that Controller is also an Actor. The plug OwnerActor tooltip says “object’Actor’ Owner Actor”, my wires short-circuited and I assumed it must always be the character/pawn 🙂

---

<div class="post-metadata">

**Author:** ![martincrackismo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@martincrackismo](https://forums.unrealengine.com/u/martincrackismo)\
**Post date:** [August 26, 2019, 9:14pm UTC](https://forums.unrealengine.com/t/how-to-play-animation-and-destroy-actor-from-bttask/291392/4 "2019-08-26T21:14:33Z")

</div>

how do you get the event receive execute? i cant even find it!

---

<div class="post-metadata">

**Author:** ![Oksvar\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Oksvar\_1](https://forums.unrealengine.com/u/Oksvar_1)\
**Post date:** [December 17, 2023, 10:50pm UTC](https://forums.unrealengine.com/t/how-to-play-animation-and-destroy-actor-from-bttask/291392/5 "2023-12-17T22:50:35Z")

</div>

Because this is custom event, you can create it by typing “add custom event”
