Destroy moving actor not working all the time

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

1 Like

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

Here’s how I have it set up:

Bullet EG + Launch function


Target

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

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:

For example, you may not need this feature now:

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.

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

1 Like

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

006c

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

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:

Ther rest is at defaults. Firing a bullet:

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.

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.

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

But then I edited the Launch function like so:

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

What am I doing wrong?

@Everynone

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

@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:

In the Pawn BP Spawn Projectile function I spawn the bullet:
pawn

In the bullet EG I check for collisions:

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

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

This is what happens:

Video

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.

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

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

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

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.

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

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.

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

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.

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