# Destroy moving actor not working all the time

**URL:** <https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651>\
**Category:** Blueprint\
**Tags:** destroying-actors, collision-detection, unreal-engine, Collision, Blueprint\
**Created:** [January 6, 2023, 3:07pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651 "2023-01-06T15:07:38Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 6, 2023, 3:07pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/1 "2023-01-06T15:07:38Z")

</div>

So I’m having this issue where I’ve set up a bullet and a few targets.

On component hit I destroy the bullet and spawn a “Blueprint Effect Explosion”.

For each actor, I copied the code and do the exact same thing. Everything works ok, except if I have an actor that is sliding left/right with a timeline.  
Sometimes it destroys the actor, other times the bullet goes right through it.

It is very inconsistent and frustrating. Is there anything I can do to fix this? I tried linking the “On Component Hit” to the collision box or the static mesh. I tried enabling and disabling CCD for both. Nothing seems to make it consistent.  
It’s a crapshoot. What am I doing wrong?  
For the static targets, everything works perfectly.

If I disconnect the timeline it works ok.

Any tips are greatly appreciated

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 6, 2023, 3:21pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/2 "2023-01-06T15:21:42Z")

</div>

> [@cnapsys](#):
>
> On component hit I destroy the bullet

How are the bullets moving - the method? How fast are they flying?

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 6, 2023, 3:40pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/3 "2023-01-06T15:40:36Z")

</div>

Here’s how I have it set up:

Bullet EG + Launch function

 ![006](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/3/e/33eb168d6d8d330eb1112e168f79a79657bfa69c.jpeg)  
 ![006a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/c/8bc3acbed1475d952b6817d5ef0cefebfad89a75.jpeg)

Target

 ![006b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/b/b/dbb102f9f3a9ff5a5a74570aa072ea457e6eb940.jpeg)

With the Timeline disconnected it works perfectly. Once I connect it it’s a hit or miss 🙂 mostly miss. It takes about 5-10 shots to actually trigger the collision

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 6, 2023, 3:46pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/4 "2023-01-06T15:46:23Z")

</div>

You will need to switch to `Projectile Movement Component` for the bullets - it comes with additional features that help with handling high velocities; as a bonus you get a ton of other useful stuff:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/6/c46d676da82bb7160c3e29585f52b43cfedd45ae.png)

For example, you may not need this feature now:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/e/a/bea279591e2ec862a5613a7d36f8a0c109e23bbf.png)

But as soon as the projectiles stat moving really fast, this comes in handy.

* * *

Regular physics will almost never be enough for something like this, especially if you expect to build a more advanced system.

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 6, 2023, 4:24pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/5 "2023-01-06T16:24:19Z")

</div>

Would you be kind enough to show me how to change it to that? And is it enough if I just add a projectile movement for the bullet? do I need to change anything else in the code for the targets?

If I’m using the projectile movement comp, do I ditch the add impulse all together or do they work in conjunction? How do I launch the bullet?

Thanks for being so patient with me, I’m still figuring things out

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 6, 2023, 4:26pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/6 "2023-01-06T16:26:17Z")

</div>

Does it matter where I anchor the PMC? Do I leave everything else the same?

![006c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/4/0/84068fb1d7d267e3d487b6f253d264a7c0394792.jpeg)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 6, 2023, 4:39pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/7 "2023-01-06T16:39:11Z")

</div>

> [@cnapsys](#):
>
> If I’m using the projectile movement comp, do I ditch the add impulse all together or do they work in conjunction? How do I launch the bullet?

When using the PMC, options do open up. The most basic bullet could work like so:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/a/e/6aea9b3efd70baeb7e82eb7eaeea21a06e1e24ae.jpeg)

Collision against the Pawn is Ignored so we do not shoot ourselves. The static mesh has collision disabled. There’s **no** physics simulation on the sphere or mesh.

You can use the following setting to give it desired speed:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/8/6/78613722e85662eb586d1a6e3291b905b1a1a362.png)

Ther rest is at defaults. Firing a bullet:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/b/f8b7e865463c9e906986f88a6157b253ceaddccc.png)

We’re shooting in the direction the player is rotated.

* * *

There’s another method of launching them using Velocity. Imagine a situation where the player is on top of a moving train. The bullets should already move at least as fast as the train due to relativity.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 6, 2023, 4:39pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/8 "2023-01-06T16:39:55Z")

</div>

> Does it matter where I anchor the PMC?

No, the only important bit is that the colliding element is at the root of the actor. Yours already is.

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 6, 2023, 5:15pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/9 "2023-01-06T17:15:17Z")

</div>

Hmmm, so I initially added the PMC with the old Add Impulse, and it was working fine…  
even with the timeline enabled:

 ![006d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/9/479fa1a7b7adb7c3c68123075d05c87be41b4bc8.jpeg)

But then I edited the Launch function like so:

 ![006e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/7/e/97ef01bfb92df27557ad9daa02d1dab595b56d87.jpeg)

Now the projectile explodes as soon as I shoot it, in front of me.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 6, 2023, 5:34pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/10 "2023-01-06T17:34:08Z")

</div>

@Everynone

Nvm… I’m an idiot. I was already spawning the bullet from the pawn and just added another spawn from the bullet itself.

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 6, 2023, 6:22pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/11 "2023-01-06T18:22:13Z")

</div>

@Everynone

Hmmm… back to square one, still not working. It seems to hit more often, but occasionally it will still go through the moving target.

If you don’t mind, could you tell me if my logic is off?

Here’s how I have it set up:

In the player controller I’m casting to the Pawn and Spawn Projectile:

 ![playercontroller](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/9/8/998247e4a8a4d0ece3f52be00c7608037987e0fb.jpeg)

In the Pawn BP Spawn Projectile function I spawn the bullet:  
 ![pawn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/9/3899d9c15fa0477e5bc90cdf7b35deb39ffa4ea0.jpeg)

In the bullet EG I check for collisions:

 ![bullet](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/6/b/c6bbe162d0049fe270fafa412aba899029be3375.jpeg)

In the Target BP, I check for collisions as well:

 ![target](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/e/34ecac374d8649599846a7b49ffe9523abab611a.jpeg)

Is this the right way? Or how else should I set this up?  
Again, for static targets it works without hiccups.

Thank you for your time and patience

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 6, 2023, 8:04pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/12 "2023-01-06T20:04:52Z")

</div>

This is what happens:

[Video](https://drive.google.com/file/d/1lcItO_jPrPlSwnMTVgb0IBXNhM_8o8eH/view)

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 9, 2023, 5:43pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/13 "2023-01-09T17:43:11Z")

</div>

I’m losing my mind.  
I think I must’ve tried every possible collision scenario (except the right one apparently). Nothing works.

If anyone is kind enough to share some tips, I’d greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 9, 2023, 5:52pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/14 "2023-01-09T17:52:32Z")

</div>

Hey, sorry - I’m not around this week but have a look here:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/e/7/2e720b87dffa58d75353f6f7b8e71d15493240a2.jpeg)

I am imagining the script does something along the lines of:

You seem to be moving the mesh only, rather than the entire actor. So the colliding elements stays in place.

- any reason why you cannot move the entire actor?
- or offset the collider with a scene component and keep you script, but do move the collider in relative space

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 9, 2023, 5:56pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/15 "2023-01-09T17:56:49Z")

</div>

I thought I actually was moving the whole thing, since the mesh is linked to the wall\_collision, which is the root. I tried getting a reference to “self” as the entire actor, but that is not a valid target for the Set Relative Location

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 9, 2023, 5:59pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/16 "2023-01-09T17:59:16Z")

</div>

hmmm, I guess I was just moving the mesh without the collision.  
However, if I plug in the collision box to the Set Relative Location… the actor just starts hopping around the scene uncontrollably… pretty funny.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 9, 2023, 6:08pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/17 "2023-01-09T18:08:35Z")

</div>

If I were to a moving target like this, I’d try it like so:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/0/3b0aec0eaf6dec8ba6773fb4f14c914a6da8513d.jpeg)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/b/9/5b93a42e6553e02bbef4bb34cf11f2a3ac40b1b1.png)

So we’re still using relative location but the box collision is attached to the root scene component that acts like a dummy in this scenario.

* * *

There will be as many ways as there are people.

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 9, 2023, 6:09pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/18 "2023-01-09T18:09:56Z")

</div>

> So we’re still using relative location but the box collision is attached to the root scene component that acts like a dummy in this scenario.
> 
> There will be as many ways as there are people.

Lol. True that. I’ll give it a try

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 9, 2023, 6:37pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/19 "2023-01-09T18:37:21Z")

</div>

Hmmm, what am I doing wrong with the timeline???  
I set it up exactly like you, but after it slides the first time, it jumps back from the beginning. (without sliding back)  
On the second slide it goes ok, forth and back.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [January 9, 2023, 8:00pm UTC](https://forums.unrealengine.com/t/destroy-moving-actor-not-working-all-the-time/743651/20 "2023-01-09T20:00:32Z")

</div>

Post a screenshot if at all possible. Sometimes it’s a tiny thing. Blueprint wires are ever so sensitive and fussy like that.
