Download

Why wont my bullets be deleted?

Hello. I am trying to delete my bullets once they hit a wall OR if they venture off into the sky for too long. I have attempted to delete them through collisions, as shown below. I understand that the target is not linked for destroy actor. Reason being, when this is unconnected, the bullets appear, and when they collide with something, the turrets that shoot them will be destroyed. However, if the target is connected for the destroy actor to the bullet blueprint, no bullets appear, and ue4 doesnt give me any errors. Here is the program:

It is evident that the issue is caused by the fact that the bullets have no time to reach their target that they collide with. How do I tell the engine to wait before they reach their target to be destroyed?

When you spawn the projectile take the return value and Set Lifespan to like 10s. Depending on velocity (IRL speeds) you can get away with 3s.

So LineTrace → Spawn → Set LifeSpan.

On Hit (projectile collision), break result → If Blocking Hit → Do damage calcs etc, then Destroy Actor.

I believe my bullets are colliding with the mesh of the turret they are firing from. Is it possible to ignore the turret they are being fired from? If not, should I place a socket that shoots the bullets? Thanks

also, it can’t work off of if blocking hit because the bullets are meant to travel. Doing this means that the bullets are hitscan. I have tried setting up the collision in the bullet blueprint in order to remove the bullets once they collide with something, yet to no avail. I have tried On Hit, Overlapping, etc and for some reason my bullets just ignore everything and fly right through them.

Edit: As a matter of fact, I have got the collision to work as I would want it to. For some reason, it prints out that it is colliding with things, but does not destroy the bullet afterwards.


It prints in console but does not delete the actor. Any ideas?

Edit 2: The walls I was using did not have overlap enabled. Now they do. If the bullet collides with the player model, the bullets disappear as planned. If they collide with the wall, they just keep going. Odd.

Show your projectile component and collision setup. Something doesn’t sound right.

DeleteBullets4
DeleteBullets5

Is this what you mean?

Edit: OHHHHHHHHHH my bullet speed was far too fast. The bullets were going so fast they never even rendered that they were inside the wall.

Everything you have set for “overlap” should be “Block”. Then use On Hit (Sphere) for hit detection.

Take the hit result, check for blocking hit, do damage etc, then destroy actor.

use time to destroy them… no bullet should be alive after a few seconds

Yeah I figured it all out. It had nothing to do with the bullet. It was spawned inside of the turret, so the turret was causing it to despawn. Now I have it set to ignore the actor when it spawns so it no longer collides with the turret that spawns it.