Projectile Pooling

While there is little help on the matter, I think I have grasped the concept of how to pool objects so that they are reusable. However, I want to create a projectile pool since projectiles from weapons are frequently called, potentially several hundred times a minute per object depending on the rate of fire of the weapon. Since spawning is a pretty heavy operation, I feel it best to do a pool. The one thing I’m unsure of is how to stop its impulse/velocity movement upon impact/death so that when I return the projectile to the pool, it remains in a single location until I need to reuse it and reapply its impulse.

Any help with projectile/object pooling is greatly appreciated!


There is one more major problem with shooting lots of projectiles, they will collide with each other, causing at best bad visual effects, at worst wasting lots of power on collision. I Found out that safe rate of fire is about 0.1 second, unless you want really tiny projectiles (but then they are almost invisible on screen). So why to bother with firing them all, you can shoot every tenth that is invisible, then trace impact point, and spawn some emitter that fakes multiple hits. And add stream of gpu emitters that fake your visible, fx part of bullets, they have collision and can die on impact. Well they even can transfer hits event over.

Unless there is real reason (like making COD simulation fps) for simulating every bullet i would not go this way.

And then do not forget multiplayer if you want implement this, 2 miniguns would saturate bandwidth if you try to replicate it.

This post may be of use to you.
What you could do is move “dead” objects to a predefined location “off world” and forget about them till you need to create “new” objects.
Basically you would be creating something like an array of objects and a second dynamic array for a list of dead/alive objects.


Ya you could do line traces instead of projectiles but that won’t always work. I’m building a tower defense blended game so not all projectiles fire in a straight line or at constant arcs. You also can’t simulate physics with line traces giving bullet drop over distance. Line traces are also instantaneous which won’t work for mortor or artillery type firing.

Collisions are of no concern, simply make a custom object type and have the projectile ignore the collisions on that channel.

Essentially this is what I am doing with my other pooled items that aren’t projectiles. Spawn them when level loads, store them totally disabled until I need one then move it to where it’s needed, enable it, use it, disable it and return it to the pool.

Problem with projectiles is they are given a force and/or impulse. Currently I can’t find a decent way to stop the impulse. If you do stop it and get it back in the pool it’s difficult to reapply the impulse. I’m trying to find the best way to handle the projectiles for the pool.

Thanks for the link though, was a good read

Projectiles don’t have to collide with each other, just adjust collision channels in project settings.
To set/reset projectile movement, a simple ‘Set Linear Velocity’ node should do the trock.