Projectile Pool

Hi guys,

I have a problem that is driving me nuts. My original problem was that I was spawning a lot of stuff in my level which was becoming quite expensive performance wise. So instead I have added everything I need in to the level and “activate” it as needed. Everything is working well except for the projectile that the player fires.

I have 50 of these hidden in the level and at begin play I create an array that holds all of them. Then, as required the player character gets one from the array, sets its transform to be at the end of the weapon and sets its velocity in local space to 4000 on X. After 2 seconds the projectile resets itself, sets its velocity back to 0 (Zero) and puts itself back in to its original hidden position, waiting to be called again.
Every time the array index gets to 48 I reset it back to 0 (zero) and we go through the array again.

The array always runs through at least once but on its second run at a random array index the velocity is not being set and the projectile does not move. I do a print string after the “set velocity in local space” node and it shows 0 (Zero) in X, Y and Z.

I have included a couple of screens below. If anybody can see where I’m going wrong or why this might be occurring it would really help me out.

Thanks for any help you can offer on this, as I said it’s driving me nuts.

Thanks,

Dave