Have projectile destroy self after X bounces

Title says it all. I am exceedingly new to UE4, and am still learning just how… literally everything works. To be more clear on what I’m going for… The projectile is a disc that I want to:

  • Bounce X times off the environment before destroying self
  • destroy self when impacting an actor
  • Turn to face the direction it is travelling in

Thankfully the basic FPS scene allows for the last two pretty easily; I turned projectile mass to zero and set rotation relative to motion? Something like that. Where I’m struggling is having the projectile pop after reaching maximum number of bounces. Think the light discs from TRON :relaxed:

Ideally I’d just like to know what to add to the existing nodes to this effect. I plan on learning how to build my own projectile systems from scratch but for now I’m just trying to rough out an idea.

Additionally, I would run a DoOnce node after the delay (possibly getting rid of the delay entirely). When the script runs false for checking whether int Hits is greater than or equal to your desired amount, reset the DoOnce node.

Bounce X times off the environment
before destroying self

  • you may want to set Initial Life Span to 0, by default the projectiles of this template live only 3s

  • the top bit is the script the projectile blueprint already has
  • I added the bit at the bottom, framed red
  • you’ll need to add an int variable (called Hits here)
  • rather than destroying the projectile after it hits other physical objects, we count the number of times it hits something
  • the ++ node adds 1 to Hits, we then compare whether this value is equal or greater than what we need
  • if the math checks out, the projectile self destructs

The Retriggerable Delay is optional but it will help filter out hits that could otherwise occur too frequently. This way, the projectile must travel for at least a 1/10th of a second before it registers a hit.

The thing with doing it with DoOnce with no Delay is that you will have it reset a dozen times in a single frame when your projectile starts sliding against a surface. Something that looks like a sliding collision…

Image from Gyazo

…will immediate exceed the counter. You may or may not want it to behave like so, ofc. If I wanted a frisbee whose durability decreses on Hit, it’d get destroyed the moment it hits the grass.

I guess it all depends what should count as a Hit in the pertinent scenario. It’s Tron so pretty much anything goes!


You may want to do something else than a simulated Hit, Begin Overlap, for example. Solves some issues and brings other… :slight_smile:

I was so close when I was messing around with this before! I keep forgetting I can literally set my own variables, and I hadnt come across the ++ node yet. Thank you!

Thank you for the tips! Here’s what I wound up with…

The comments on the nodes are more for me, so I know what I’m looking at when I come back to this. I was trying to be a bit clever and as far as i can tell, it works! Having it print on bounce and what caused the self-destruct helps me know whats getting triggered :slight_smile: