nbenven95 / BattleTank

Second major project in the Udemy Unreal Engine 4 course (project is actually C++, github seems to have goofed)
0 stars 0 forks source link

Despawning projectiles #29

Closed nbenven95 closed 5 years ago

nbenven95 commented 5 years ago

Need to remove the collision mesh of the projectile when it hits something. Since the collision mesh is the root component in the blueprint, need to make the impact blast the root first, then we can delete the collision mesh.

Have a fixed number of projectiles in an object pool that represents the max number of projectiles that can be available in the world at a given time. Instead of spawning a new projectile each time a tank fires, it grabs a projectile from the object pool and enables it. When the projectile hits something, it gets disabled. This way, we aren't constantly instantiating and disabling objects.

Instead of object pooling, just going with the simple solution and using a despawn timer for each projectile.