Download

Spawning bullet shell particle with inconsistent results

I’m trying to set up a particle system for creating spent bullet shells when using a firearm in VR. The problem I am encountering is it seems to stop spawning new particles when the existing particles from the system hit their lifetime limit. Here’s a video illustrating the issue:
[video=“youtube;3_B7oNWaeJ0”]UE4 Particle shells don't reliably spawn/draw - YouTube

It’s hard to see in the video (sorry for the **** quality encoding, not sure what happened there), but it looks like it’s trying to move the existing particles on the ground once the first ones start going away. And I don’t really show this in the video either, but after all the existing particles have been killed, I can start spawning as many new ones as possible (spawning correctly) until they start disappearing again. It doesn’t appear to be a limit in the number of particles being spawned. I’ve tested with another firearm with a way higher rate of fire, and it will spawn as many shells as it should until, again, the old ones start going away. Turning the lifetime off in the particle kinda-sorta fixes the problem, until it hits (what I assume) is some upper limit of overall particles allowed and wont render any more, at all, ever, for that firearm. I definitely want them to disappear shortly after spawning for all sorts of reasons anyway, so that doesn’t seem like much of a solution.

As for my setup, in the blueprint for the firearm I have a particle system component. On Beginplay, I set the desired particle template (which is defined elsewhere depending on the type of ammo being used, so different ammo can have different ejected shells):

Also on Beginplay, I set the transform and which socket I want the particle to be attached to:

The particle system is set to only spawn one shell particle on activation, so the way I trigger the bullet shells to spawn is to activate the particle system in my firing loop:
center.PNG.jpg

As far as I can tell in the particle itself, there is no way to control particle spawning in the way I’m seeing it happen in game. Hopefully I’m just missing something obvious.

Also as a side note, I was previously spawning in the particle by using a “Spawn Emitter Attached” node in place of the activate node i’m now using.:
side.PNG

Visually, this seemed to work perfectly fine, and the particles behaved as I would expect them. The problem with this approach is I couldn’t figure out a way to receive any events generated by the particle system in my firearm blueprint (which I am using to play sounds when the bullet shells collide with the world). I suspect doing it the way I have it currently set up is probably performant as well since there is only ever one particle emitter per firearm. If that’s not the case I’d love to learn more.

THAT ENDING THO !!! HAHAHAHAHAHHAHAHHAA
100% unexpected, but, man that was great!

I would check the particle life

im thinking / typing out loud here …

i wonder if the system says “well i spawn 1 shell per particle”
since it sees 1 on the floor, it wont spawn.
could it be something with the count technically being there, thats why they have to “despawn” before you can get more?
so if we ignore the count totally and remove the trigger does it work as intended?

remove shells, doe it always work?
allow shells to work indi from the particle system - still work?

Haha, thanks! Virtual ragequitting is the best part of VR.

And thanks for taking the time to come up with some ideas. I was going through testing the stuff you suggested, and I stumbled on the solution. It turned out, the particle system had a “emitter initial location” module, that was referencing itself in the “emitter name” field. Not sure why it only started acting weird after the particles started being killed off, but that was the cause of the problem. Disabling the module fixed the problem completely. aw yes!

a146abedd98559e662726a58b681926115c2a2dc.png

Any chance you’d be willing to share the rest of your particle setup for this?

This is practically the fist particle I’ve had to create, and when it comes to creating shell ejection particles and a lot of the forum posts lead to this tutorial: FX: Create ammo shell particle from mesh | Shooter Tutorial

I’ve followed along with that tutorial but the results are not nearly as good as the ones in your video. Any guidance would be much appreciated!

I cant believe I missed your reply @playhouse! Better late than never I suppose. Here’s the setup we’ve been using so far for our bullet shells.

The particle itself is constructed with these modules:

ParticleCollisionModules.JPG
Required settings:

Spawn Settings:

Event Generator Settings:

Actor Collision Settings:

In the BP that uses the particle system, I have an particle system component pointing to the appropriate particle asset, with auto-activate set to false (while this wouldn’t be the end of the universe if it were set to true, it causes a shell to eject the instant the BP is spawned in the world, and that is not desirable behavior in our situation)
image_161530.jpg

When you want to spawn a shell, you need to use the activate node on the component (we’re using a validated get node in our code because some guns don’t eject shells, but it’s not necessary if you know your particle system component will always be there):
image_161531.jpg

Finally, in order to actually play audio on particle collision, you’ll need to create a OnParticleCollide node for your particle component. (Note that you’ll have to have the component highlighted in order to find the node):

We’re calling a wwise event to play sounds but you can hook up a regular old unreal sound node (or anything else for that matter) for the desired effect.

Hope this helps! it’s been a while since we got all this stuff working so I hope i’m not forgetting anything crucial. I’ll try to keep an eye out on my forum notifications this time around if you post any more questions.

Edit: Fixed the images…?