Hi, I am new to unreal and I cant understand how to make a projectile disappear after a short distance travelled? In my game I want it to make it so that you cant attack from to far away. Also I don’t want to use delay to destroy since there will be some with different speed and with delay that will increase the distance travelled to and I don’t want that to happen. Can anyone give me a tip on how to do that?
Set Initial Life Span
to either 0 or, better, to some distinct value, like 60s - in case the projectile never travels far enough, it will be destroyed after this time anyway. You don’t want to be stuck with 2000 projectiles lodged somewhere after 15 mins of play, consuming resources.
You can then measure how far a projectile has travelled from its original spawn. Should the value be exceeded (here, 1000uus), the actors destroys itself:
See if this delivers. The above does not need to be on tick if the exact distance is not that important. You could run a timer 5 times per second and it may be fine too, or tick less often.
1 Like
That did exactly what I needed. Thank you very much!